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'

comments
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
Join a Chapter
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Get Career Advice from Experts