How to find where a table is referenced?

Posted by Zafar Iqbal on Friday, February 09, 2007 - 00:24

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

SELECT o.name, t.TABLE_NAME, c.textFROM 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