Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / database / SQL-Server

Find particular word or text from the entire stored procedure

4.50/5 (6 votes)
26 Apr 2011CPOL 11.6K  
You can create a simple stored procedure like that:DECLARE @StringToSearch varchar(100)SET @StringToSearch = 'GetEmployee'SET @StringToSearch = '%' +@StringToSearch + '%'SELECT Distinct SO.NameFROM sysobjects SO (NOLOCK) INNER JOIN syscomments SC (NOLOCK) on SO.Id = SC.ID AND...
You can create a simple stored procedure like that:
SQL
DECLARE @StringToSearch varchar(100)
SET @StringToSearch = 'GetEmployee'

SET @StringToSearch = '%' +@StringToSearch + '%'
SELECT Distinct SO.Name
FROM sysobjects SO (NOLOCK)
   INNER JOIN syscomments SC (NOLOCK) on SO.Id = SC.ID
   AND SO.Type = 'P'
   AND SC.Text LIKE @StringToSearch
ORDER BY SO.Name
GO

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)