Solved

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

Posted on 2006-06-27
4
435 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 25 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 25 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

685 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