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.
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.
Asking a SQL Question That Gets Answered: The Reproducible Script
Write a reproducible script with minimal tables, synthetic rows, the failing query, expected results, and the exact SQL Server version.
SQL Server Management Studio – New Feature – Object Explorer Query Tracking
Object Explorer Query Tracking exposed SSMS queries while expanding nodes in the historical release. I used its Output window for investigation.






