Skip to content

Instantly share code, notes, and snippets.

@theuntitled
Created February 27, 2019 09:37
Show Gist options
  • Save theuntitled/0ed5fcb170334f1c9a78ead386027e7a to your computer and use it in GitHub Desktop.
Save theuntitled/0ed5fcb170334f1c9a78ead386027e7a to your computer and use it in GitHub Desktop.
Measures the elapsed time for a query in milliseconds.
DECLARE @t1 DATETIME;
DECLARE @t2 DATETIME;
SET @t1 = GETDATE();
-- Query to measure
SET @t2 = GETDATE();
SELECT DATEDIFF(millisecond,@t1,@t2) AS elapsed_ms;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment