Posts Tagged ‘Object Dependencies’


How to find all places where object (Table/view/Text etc..) is used


Recently I have one change in a table schema. To make this change I need to be sure that it should not raise an error. To make suare that I need to get all the places where I used this table in whole DB and my DB is too big.

So I triued for that and come with the solution, that I need to share with all of you.

I wrote one query which will give me all the objects in which i have used the TEXT that i want to search.

Query for SQL 2005:

FROM sysobjects o
INNER JOIN syscomments c ON c.Id = o.Id
WHERE category = 0 AND c.text like ‘%’ + ‘<TableName>’ + ‘%’

So it save my life. I found all the objects where I used that table and fix if needed. Let me know if this can help you !