A wait stats collection script saves snapshots of sys.dm_os_wait_stats into a table, so you can compare two snapshots instead of reading totals since the last restart. This post builds the tables and a snapshot procedure, creates a small load, and reports the change with a category for each wait. It also covers idle waits, restarts and retention.
SQL SERVER – Get Wait Stats Related to Specific Session ID With sys.dm_exec_session_wait_stats
From SQL Server 2016, sys.dm_exec_session_wait_stats shows wait stats for a specific session ID. Here is how to use it, and why it fails on older versions.
What is the Biggest Limitation of ISDATE() Function? – Interview Question of the Week #137
Why does ISDATE(‘6666-04-30’) return 1 but ISDATE(‘1111-04-30’) return 0? Here are what I see as the two biggest limitations of the ISDATE() function.
SQL SERVER – Puzzle – Write a Shortest Code to Produce Zero
This Zero puzzle asks for the shortest SQL Server code within three restrictions. I want the exact code and character count.
SQL SERVER – Learning DATEDIFF_BIG Function in SQL Server 2016
DATEDIFF returns INT and overflows with Msg 535 on large ranges. SQL Server 2016 adds DATEDIFF_BIG, which returns BIGINT. Here is a simple example.






