Answers for "record how long a query takes"

SQL
1

timing sql queries

DECLARE @t1 DATETIME;
DECLARE @t2 DATETIME;

SET @t1 = GETDATE();
SELECT /* query one */ 1 ;
SET @t2 = GETDATE();
SELECT DATEDIFF(millisecond,@t1,@t2) AS elapsed_ms;

SET @t1 = GETDATE();
SELECT /* query two */ 2 ;
SET @t2 = GETDATE();
SELECT DATEDIFF(millisecond,@t1,@t2) AS elapsed_ms;
Posted by: Guest on January-25-2021
-1

timing sql queries

SELECT GETDATE();
SELECT /* query one */ 1 ;
SELECT GETDATE();
SELECT /* query two */ 2 ; 
SELECT GETDATE();
Posted by: Guest on January-25-2021

Code answers related to "record how long a query takes"

Code answers related to "SQL"

Browse Popular Code Answers by Language