Timing SQL statements
but if you’re trying to shave milliseconds off a query that takes under a second than the result "00:00:00" doesn’t give you anything to go on.
So; instead, if you declare a @timeStart as a datetime, run your query, then get a datediff in milliseconds against the current time, then you get something more meaningful.
declare @timeStart as datetime
set @timeStart = getdate()
select count(*) from foo
In the above code block "select count(*) from foo" is the query I want to test.