Queires run as part of stored procedures, SQL server 2008R2

Hi experts,

I have an application that runs a stored procedure, behind which is a myriad of other stored procs and functions.  I ran the main stored proc with execution plan, and that shows 125 different queries were run.

What I want to do is get a list of all of those queries thru T-SQL.  The execution plan gets this info, so it should be possible.

Thanks in advance.

Col
LVL 3
colinspursAsked:
Who is Participating?
 
x-menConnect With a Mentor IT super heroCommented:
sp_helptext myStoredProcedure
0
 
colinspursAuthor Commented:
Thanks, I was hoping it could do the drilling down for me and find the dependent hierarchy?

But this is very helpful.
0
 
Surendra NathTechnology LeadCommented:
if that is what you are looking for...
you can start looking at the system table sys.dm_sql_referencing_entities

More information about this can be found at
http://blog.sqlauthority.com/2010/02/04/sql-server-get-the-list-of-object-dependencies-sp_depends-and-information_schema-routines-and-sys-dm_sql_referencing_entities/
0
 
colinspursAuthor Commented:
Cheers, thanks for that.  Guess I should have put another question out, but there will be plenty more on this stuff from me I'm sure...trying to learn fast.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.