I am providing search functionality in my website, when user searches a record then I want to display the time the query taken to get the results same as google does. When w
try this
DECLARE @StartTime DATETIME
SET @StartTime = GETDATE()
SET @EndTime = GETDATE()
PRINT 'StartTime = ' + CONVERT(VARCHAR(30),@StartTime,121)
PRINT ' EndTime = ' + CONVERT(VARCHAR(30),@EndTime,121)
PRINT ' Duration = ' + CONVERT(VARCHAR(30),@EndTime -@starttime,114)
If that doesn't do it, then try SET STATISTICS TIME ON