RE: Pattern search in syntax

RE: Pattern search in syntax

 

  

Got this from lister Vince Larson a while back:

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

-----Original Message-----
From: Viradia, Ashish [mailto:[Email Address Removed] Wednesday, August 28, 2002 6:34 AM
To: LazyDBA.com Discussion
Subject: Pattern search in syntax


Buddies,

Does anyone have a code to find pattern in syntax of all
database
objects & list them?

Thanks.

- Ashish.

---------------------------------------------------------------------
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page