Pages

Sunday, March 9, 2008

Count T-SQL code execution

The first thing you can do is simply compare the difference between the timestamp BEFORE your query, and the timestamp AFTER.

DECLARE @start DATETIME, @End DATETIME
SET @start = CURRENT_TIMESTAMP

DECLARE @i INT
SET @i = 0
WHILE @i < 24000
BEGIN
SET @i = @i + 1
END
SET @End = CURRENT_TIMESTAMP
SELECT DATEDIFF(MS, @start, @End)

No comments: