Find the execution time of a stored procedure

By Venkatesan Jayakantham 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'

Venkatesan Jayakantham

I am Venkatesan Prabu Jayakantham(SQL Server DBA and Dotnet developer) from India (Tamil Nadu). A Microsoft SQL Server MVP,MCITP,MCTS,MCAD,CCNA,QAI certified Expert.  I am a Mindcracker MVP for the year 2010. &nbs... Read more



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