Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Query

Author  Topic 

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2012-04-27 : 16:15:20
I'd like to know if there's a way to list all the dependency of tables and views within a stored procedure in all databases on a seerver.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-27 : 16:19:36
yep. you can use sp_depends for that

to iterate through tables,views list you can use cursor or looping logic over INFORMATION_SCHEMA.TABLES catalog view

to iterate through databases make use of system stored procedure sp_Msforeachdb

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -