SQL Server 2005 - View SPs Running Inside SP

I am wondering if it is possible to view stored procs that are executed by other stored procs in the Sql Server Profiler, is this possible, and if so, how?

+4
source share
1 answer

If you use the SP :: Starting profile, you can view all stored procedures that are running. You want to make sure that two profile columns are included:

NestLevel - shows the nesting level of SPs that call each other, so if Test calls EmbeddedTest, then the SP :: Starting event for Test wil shows NestLevel = 1, and the event for EmbeddedTest displays NestLevel = 2

ObjectName - shows the name of the executable stored procedure

SPID - session identifier for connection

So, to find the sequence of calls, you need to look for an event with NestLevel greater than 1, and then look for NestLevel = 1 on the same SPID that preceded the call. Of course, this also works for deeper nesting levels.

+4
source

All Articles