January 27, 2009

Search text in All Stored Procedures in a Database

declare @searchString varchar(100)
Set @searchString = '%' + strSearchText+ '%'
SELECT Distinct SO.Name
FROM sysobjects SO (NOLOCK) I
NNER JOIN syscomments SC (NOLOCK)
on SO.Id = SC.ID AND SO.Type = 'P'
AND SC.Text LIKE @searchString
ORDER BY SO.Name

2 comments:

Anonymous said...

Thanks dude...that works...

Anonymous said...

You're the boss! tks