Search This Blog

Google Analytics

Monday, June 10, 2013

MSSQL: Get All Stored Procedures With References to a Table

AFAIK, there is no built-in feature to generate a list of stored procedures that made references to a specific database table. The following help me to do just that.

SELECT DISTINCT so.name
FROM syscomments sc INNER JOIN sysobjects so ON sc.id = so.id AND so.xtype = 'P'
WHERE sc.TEXT LIKE '%TABLE_NAME%'

No comments:

Post a Comment

Do provide your constructive comment. I appreciate that.

Popular Posts