SQL - Buscar String en todos los SP de una Db

 
Vista:

Buscar String en todos los SP de una Db

Publicado por Alejandro (1 intervención) el 17/05/2007 15:12:42
Como puedo buscar en todos los Sp de una Base de datos una cadena de texto especifica
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Buscar String en todos los SP de una Db

Publicado por Isaías (5072 intervenciones) el 17/05/2007 21:25:53
Alejandro

Te pongo 3 opciones de 3 grandes maestros del SQL, selecciona la que mas te guste:

------ Emilio Boucaou
Declare @objname nvarchar(776)
Create table ##Listado (Objname nvarchar(776))

declare Lista cursor for

Select name from sysobjects
where xtype='P'
open lista

Fetch lista into @objname
while @@fetch_status=0
Begin
if exists(Select 1 from syscomments
where id = object_id(@objname) and encrypted= 0
and Patindex(Upper('%ACA COLOCAS LO QUE QUIERES
BUSCAR%'),Upper(text))<>0)
begin
insert ##listado select @objname
end
Fetch lista into @objname
End

Close Lista
Deallocate Lista

Select * from ##listado
drop table ##listado

------------- Eladio Rincon
select routine_name
from information_schema.routines
where
routine_type = 'PROCEDURE'
and routine_definition like 'tu_texto'
------------- Justing Xiang
Select name
from sysobjects
where type = 'P'
and id in (Select id from syscomments where text like '%..........%')
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar