all groups > sql server misc > october 2004 >
You're in the

sql server misc

group:

search for a string in stored procedure


search for a string in stored procedure sudhakarp80 NO[at]SPAM gmail.com
10/13/2004 4:34:59 PM
sql server misc:
hi

I have a very large database with several stored procedures. now, I
need to find a stored procedure that does some calculation if that
stored procedure has a string "MESSAGE"(just an example) in an IF
statement somewhere down the procedure.

currently i am opening every stored procedure, doing a Ctrl+F for the
above string and if i find it then that means i determine that this is
the stored procedure that i will have to work with(change the
calculation in it or some work)

so my question is that can i write something ... that will list me all
the stored procedures which have a certain string contained in them??

I am new to sql stuff .. so please help me. this could save me a lot
of time.

thanks
Re: search for a string in stored procedure OK
10/16/2004 10:25:37 PM
SQL Server Enterprise Manager has an option to export all of your
stored procedures to a file and then it would be a simple matter of
opening up that file in Notepad and doing a search. Not the most
elegant solution but it works for me.

Or, if you have all of your schema files under source control in
SourceSafe, you can do a search from there.


On 13 Oct 2004 16:34:59 -0700, sudhakarp80@gmail.com (messageman)
[quoted text, click to view]
Re: search for a string in stored procedure Greg D. Moore (Strider)
10/17/2004 12:42:07 AM

[quoted text, click to view]

Folks... this is a database. Think like a database. :-)


select name,c.id,text from syscomments as c inner join sysobjects as o on
c.id=o.id where text like '%foo%'



Then
[quoted text, click to view]

Re: search for a string in stored procedure OK
10/17/2004 9:46:58 PM
Agreed, this is an easy way to find things but I like having the dump
of the procedures or whatever in front of me to actually view the code
in a neat format once I've found it since that's usually why I've done
the search in the first place.


On Sun, 17 Oct 2004 00:42:07 GMT, "Greg D. Moore \(Strider\)"
[quoted text, click to view]
AddThis Social Bookmark Button