Link to home
Start Free TrialLog in
Avatar of Colin Brazier
Colin BrazierFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of x-men
x-men
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Colin Brazier

ASKER

Thanks, I was hoping it could do the drilling down for me and find the dependent hierarchy?

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