Feb 9, 2012

Sql query to get all stored procedures name which contains given text or string in sql server

Sql query or script to get or list or search all the user defined stored procedures name which contains or keeps given text OR strings in sql server



DECLARE @SearchText AS VARCHAR(100)
SET @SearchText = 'ntLogID'


SELECT name  
FROM Sys.procedures 
WHERE OBJECT_DEFINITION([object_id]) 
LIKE '%' + @SearchText + '%'


or



SELECT name  
FROM Sys.procedures 
WHERE CHARINDEX(@SearchText, OBJECT_DEFINITION([object_id])) > 0

No comments:

Post a Comment