1DECLARE @t1 DATETIME;
2DECLARE @t2 DATETIME;
3
4SET @t1 = GETDATE();
5SELECT /* query one */ 1 ;
6SET @t2 = GETDATE();
7SELECT DATEDIFF(millisecond,@t1,@t2) AS elapsed_ms;
8
9SET @t1 = GETDATE();
10SELECT /* query two */ 2 ;
11SET @t2 = GETDATE();
12SELECT DATEDIFF(millisecond,@t1,@t2) AS elapsed_ms;
1SELECT GETDATE();
2SELECT /* query one */ 1 ;
3SELECT GETDATE();
4SELECT /* query two */ 2 ;
5SELECT GETDATE();
6