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.

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

But this is very helpful.
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
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.
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.