Below is a short stored procedure I wrote recently and keep in the master
database to do just such a thing. I was more concerned with stored
procedures but as I glance over it, I think it searches all objects--if not
it's an easy modification. The thing I like about it is it can be executed
from master and it searches all databases on the server--just pass in the
string for which you're searching.
CREATE procedure searchServer (
@Searchword varchar(255))
as
begin
declare @searchstring varchar(2000)
SET @searchstring= 'select "?" as DBName, so.name as ProcedureName from
?..syscomments sc inner join ?..sysobjects so on sc.id=so.id where sc.text
like "%' + @searchword + '%"'
EXEC sp_MSforeachdb @command1= @searchstring
end
GO
Hope it helps.
-----Original Message-----
From: Sexton, Kevin [mailto:kevin.[Email Address Removed] Saturday, February 02, 2002 8:25 AM
To: [Email Address Removed] searching for string thru all procs.
I need to find all occurences of the string 'AS ELIG_ID' in my code
(triggers, functions, procs.)
This is not an Object Search.
-Kevin
---------------------------------------------------------------------
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed] NOTICE: The information contained in this message is legally
privileged and confidential information intended only for the use of the
individual or entity named above. If the reader of this message is not the
intended recipient, or the employee or agent responsible to deliver it to
the intended recipient, you are hereby notified that any release,
dissemination, distribution, or copying of this communication is strictly
prohibited. If you have received this communication in error, please notify
the author immediately by replying to this message and delete the original
message.
Thank you.
MS Sql Server LazyDBA home page