Thursday, July 25, 2013

Find all Stored Procedures depending on a Table in Database

We can use sp_depends, sp_depends displays information about database object dependencies, such as the views and procedures that depend on a table or view, and the tables and views that are depended on by the view or procedure

But some times sp_depends does not always return accurate results.

Here is how you can get accurate results by using this query’s below

SELECT DISTINCT o.name, o.xtype
FROM syscomments c
INNER JOIN sysobjects o ON c.id=o.id
WHERE c.TEXT LIKE '%TableName%'


No comments:

Post a Comment