Solved

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

Posted on 2014-01-22
4
264 Views
Last Modified: 2014-01-23
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
0
Comment
Question by:colinspurs
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
x-men earned 500 total points
ID: 39800310
sp_helptext myStoredProcedure
0
 
LVL 3

Author Comment

by:colinspurs
ID: 39800430
Thanks, I was hoping it could do the drilling down for me and find the dependent hierarchy?

But this is very helpful.
0
 
LVL 16

Expert Comment

by:Surendra Nath
ID: 39800441
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
 
LVL 3

Author Comment

by:colinspurs
ID: 39803142
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

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Suggested Solutions

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now