How to find where a table is referenced?

When you need to find all procedures and function referencing a particular table then use following:


SELECT o.name, t.TABLE_NAME, c.text
FROM syscomments c JOIN sysobjects o ON c.id = o.id JOIN INFORMATION_SCHEMA.Tables t ON c.text LIKE '%'+t.TABLE_NAME+'%'

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.