Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to find total execution time for a query or stored procedure?

Posted on 2006-06-27
4
Medium Priority
?
453 Views
Last Modified: 2012-08-14
Is there any way to find total execution time for a query or stored procedure?
0
Comment
Question by:ynaina
4 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 100 total points
ID: 16991320
Method 1 : Use SQL server Profiler
Method 2 :

DECLARE @TimeIn datetime
SET @TimeIn  = getdate()

exec spName

SELECT DATEDIFF(mm, @timeIn, Getdate() ) as 'ExecutionTime'
0
 
LVL 50

Assisted Solution

by:Lowfatspread
Lowfatspread earned 100 total points
ID: 16991337
technically

only method1 will allow you to obtain the execution time...

method2 just gives you the elapsed time...

;-)
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question