August 27, 2013 at 8:40 am
Hi,
I want to list down the table name and which database it belongs which are used in the Stored Procedure.
for exmple:
if my Stored proc has two tables tbl1 and tbl2 and db2.tbl1 and db1.tbl2 then i want to list down those tables and Database name.
Plz suggest thnx.
August 27, 2013 at 9:02 am
you can look in sys.depends, but it's not reliable. There are tools, like Red Gate's Dependency Tracker (http://www.red-gate.com/products/sql-development/sql-dependency-tracker/) that can give you exact listings.
Disclosure, I work for Red Gate
August 27, 2013 at 9:26 am
srry i cant use red gate its restricted at our organisation. plz suggest ant other method
August 27, 2013 at 9:54 am
raj.prabhu001 (8/27/2013)
srry i cant use red gate its restricted at our organisation. plz suggest ant other method
As Steve suggested you can use sql_expression_dependencies (http://technet.microsoft.com/en-us/library/bb677315.aspx)
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply