Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Query execution time in milliseconds

Author  Topic 

badinar
Starting Member

14 Posts

Posted - 2008-10-09 : 13:53:01
Is there a way to find the execution time of sql query in milliseconds ?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-09 : 13:58:01
easiest way is to capture execution time using SQL Profiler. it will give you duration in ms

alternatively use code below

DECLARE @StartTime datetime,@EndTime datetime

SELECT @StartTime=GETDATE()

....your sql query here

SELECT @EndTime=GETDATE()

SELECT DATEDIFF(ms,@StartDate,@EndDate) AS [Duration in millisecs]
Go to Top of Page

badinar
Starting Member

14 Posts

Posted - 2008-10-09 : 14:53:52
Thanks a lot visakh16 works like charm!!
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-09 : 15:47:28
SET STATISTICS TIME ON
SET STATISTICS IO ON




E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

badinar
Starting Member

14 Posts

Posted - 2008-10-10 : 12:01:14
no code is always welcome!!

quote:
Originally posted by Peso

SET STATISTICS TIME ON
SET STATISTICS IO ON




E 12°55'05.63"
N 56°04'39.26"


Go to Top of Page
   

- Advertisement -