Click here to Skip to main content
15,886,071 members
Articles / Database Development / SQL Server
Alternative
Tip/Trick

Find particular word or text from the entire stored procedure

Rate me:
Please Sign up or sign in to vote.
4.50/5 (6 votes)
26 Apr 2011CPOL 10.6K   2   4
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)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralReason for my vote of 5 Reason for my vote of 5 Good one Pin
RaviRanjanKr19-May-11 18:02
professionalRaviRanjanKr19-May-11 18:02 
GeneralReason for my vote of 2 syscomments gives you the first 4000... Pin
dmjm-h3-May-11 5:59
dmjm-h3-May-11 5:59 
GeneralGreat! Pin
Sunasara Imdadhusen2-May-11 22:57
professionalSunasara Imdadhusen2-May-11 22:57 
GeneralReason for my vote of 5 Good One!! 5d. Pin
Gandalf_TheWhite29-Apr-11 1:10
professionalGandalf_TheWhite29-Apr-11 1:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.