Thursday, November 07, 2013

Query to check table Uses in other DB Objects

In the requirement where user want to find out that the particular table used or exist in which all db objects like SP, Views etc.
This is necessary like when you want ot purge the table or change any column of table you should check the the objects using that table shoulnd stop working.
Below is the query which will provide this details

SELECT b.name, b.xtype
FROM syscomments A
INNER JOIN sysobjects B ON A.id=B.id
WHERE A.TEXT LIKE '%Department%'

No comments:

Post a Comment