Find the execution time of a stored procedure

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

Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.

Latest Blogs