T-SQL script - Find Stored Procedure & Functions Related to Table in Database – Search in All Stored Procedure

Below script using system table in sql server can be used to get list of Stored procedure and function that references a particular table.

SELECT DISTINCT SO.name, SO.xtype
FROM syscomments SC
JOIN sysobjects SO ON SC.id=SO.id
WHERE SC.TEXT LIKE '%tablename%'

See Also: 


No comments: