8.3.08

To retrieve the query execution time

CURRENT_TIMESTAMP is used to retrieve the current time. By using this system function we can compare the time before and after the query execution.
Code Snippet

declare @qry varchar(100), @StartLoc int
DECLARE @StartTime datetime,
@EndTime datetime
SET @StartTime = CURRENT_TIMESTAMP;
-- **********QUERY TO BE CHECKED *************
SELECT *
FROM [Venkat]

-- *****************************************
SET @EndTime = CURRENT_TIMESTAMP
SELECT DATEDIFF(ms, @StartTime, @EndTime)
GO

No comments:

Post a Comment