Sunday, July 15, 2012

SQL SERVER – Find out the stored procedure which contain the selected Column name


 Using below T-SQL Script we can get the name of Stored Procedures and Text of the Stored Procedures where how many procedures are containing the particular column name like as 'Name'

USE AdventureWorks
GO

SELECT o.Name Stored_Procedure_Name, s.TEXT Stored_Procedure_Text
FROM sys.syscomments s
INNER JOIN sys.objects o
ON s.Id = o.OBJECT_ID
WHERE s.TEXT LIKE '%' + 'name' + '%'
AND TYPE = 'P'
GO
-- Here 'Name' is Column name which is used in Stored Procedure.


Result:



Like and Share to SQL Integrity Blog

No comments:

Post a Comment

Thank You !!!!