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
 General SQL Server Forums
 New to SQL Server Programming
 list store procedures that reference any table ?

Author  Topic 

alejo46
Posting Yak Master

157 Posts

Posted - 2012-01-17 : 11:18:45
Good morning
Is there any system table or command that prints out a list of store procedures for a referenced table or view ?

i.e ive got a table called SUBSCRIBERS, so i need to know which sp reference that table ?

if so, the command is the same in sqlserver 2000 and 2008 or is any difference ?

thanks for your help

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-01-17 : 11:25:47
If you are on SQL 2008, lookup sys.dm_sql_referencing_entities ( http://msdn.microsoft.com/en-us/library/bb630351.aspx )

If not, you can use something like this, but obviously you are searching for a string, so it may bring back spurious results.
SELECT * FROM sys.objects WHERE object_definition(OBJECT_ID) LIKE '%SUBSCRIBERS%'
Go to Top of Page
   

- Advertisement -