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
 SQL Server Administration (2008)
 List of queries that reference a table

Author  Topic 

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2011-03-03 : 22:39:43
Is there a query I can run that will give me all of the queries that reference a certain table?

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2011-03-04 : 05:40:33
Try exec sp_depends <object name>
or query sys.sql_modules and search the definition column
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-03-04 : 06:09:01
As with everything else, it depends. You can search through alle procedures/views etc using this script:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=134971

Alternatively you can start a profiler trace that filters on the table name...

- Lumbago
My blog-> http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/
Go to Top of Page
   

- Advertisement -