the bellow query gives me execution time in milliseconds
SELECT @StartTime=GETDATE()
SELECT count(1) FROM tab1
SELECT @EndTime=GETDATE()
SELECT DATEDIFF(ms,@StartTime,@EndTime) AS [Duration in milliseconds]
SELECT @TIMEVALUE = DATEDIFF(ms,@StartTime,@EndTime)
the ms
I guess for milliseconds , how to do convert to seconds ?
You can do the count in second directly.
Select DATEDIFF(s, @Start, @End)
here more information on datediff: https://msdn.microsoft.com/en-us/library/ms189794.aspx