Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Find Time taken by inner procedure

Author  Topic 

Vishal_sql
Posting Yak Master

102 Posts

Posted - 2012-10-12 : 05:47:16
Hi All,
I have been assigned task , to find the time taken by procedure within procedure.

eg:-
I have ProcA , which has ProcB and ProcC.

If ProcA is taking 2 mins.
Is there any way to know the time taken by inner ProcB and ProcC ?

Please help.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-10-12 : 07:06:02
If you are looking for elapsed time, and if you can insert diagnostic code stored proc, you can insert some code into the outer stored proc like below:
DECLARE @start DATETIME = GETDATE();
EXEC YourInnerStoredProc;
DECLARE @elapsedMilliSeconds = DATEDIFF(ms,@start,GETDATE()) ;
PRINT @elapsedMilliSeconds;
Go to Top of Page
   

- Advertisement -