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
 SQL Server Administration (2005)
 list tables which are used by a SP

Author  Topic 

hbharath
Starting Member

9 Posts

Posted - 2007-09-17 : 10:48:52
Hi,
I got a request from a devloper asking, how can he find out what tables his stored procedure his using, so he can remove unwanted SP which are using old tables in the database.

Bharath JrDBA

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-09-17 : 10:55:25
You can use sp_depends as the least help but that's not very reliable. Probably you can query syscomments table to find out tables referred by SPs.

Select object_name(id) from syscomments where text like '%oldtable1%' and objectproperty(id, 'IsProcedure')


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-09-17 : 11:21:07
it seems that sysdepends has been improved in sql server 2005.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

hbharath
Starting Member

9 Posts

Posted - 2007-09-17 : 12:09:12
Thanks Harsh & spirit 1. I hope dis will help d devloper.

Bharath JrDBA
Go to Top of Page
   

- Advertisement -