In this article, I am explaining, How to find Stored Procedure, View, and Function list Related to a particular Table in SQL Database. Below query, help to find that
SELECT DISTINCT b.name, b.xtype
FROM syscomments a
INNER JOIN sysobjects b ON a.id = b.idWHERE a.TEXT LIKE '%tablename%'
If we want to search table only in the stored procedure then we can use the below query
SELECT Name
FROM sys.procedures
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%tablename%'
No comments:
Post a Comment