Blog

Find the execution time of a stored procedure

Posted by Venkatesan Jayakantham Blogs | SQL May 10, 2012
Find the execution time of a stored procedure in SQL Server

The best way is to use SQL profiler. Just choose the required events.Else if you dont have the permission to access SQL Profiler or want to determine that programatically, then try:

 

DECLARE @StartDate datetime, @EndDate datetime

SET @StartDate = getdate()

 

/*

--Exec your stored procedure code here--

*/

 

SET @EndDate = getdate()

 

SELECT datediff(ms,@StartDate, @EndDate) AS 'Milliseconds'

COMMENT USING
PREMIUM SPONSORS
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.
SPONSORED BY
  • MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.