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 2005 Forums
 Transact-SQL (2005)
 Listing all tables used within each stored procs

Author  Topic 

harlingtonthewizard
Constraint Violating Yak Guru

352 Posts

Posted - 2009-01-15 : 23:17:36
Listing all tables and ideally all fields used within each stored procedure. So output would look something like:

Procedure Tables Fields
Comments_Count UserDetails Name, Position
Comments_Count UserGroup Tech, Admin
Comments_Count Comments Comment, CommentID
UserCount User UserID, UserName

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-15 : 23:29:45
start with sp_depends
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-01-15 : 23:33:00
exec sp_depends 'storedprocedurename'

u will get tables used only in particular database otherdatabase tables which are used in that sp will not come
Go to Top of Page

harlingtonthewizard
Constraint Violating Yak Guru

352 Posts

Posted - 2009-01-15 : 23:39:36
Thanks that does the trick, sometimes just need to know what to look for:)
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-01-15 : 23:48:20
ur welcome
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-15 : 23:55:04
also have a look at sys.sql_modules catalog view
Go to Top of Page
   

- Advertisement -