SQL: Buscar objetos en la Base de datos

CREATE PROCEDURE [dbo].[FindTextInDatabase]
    -- Add the parameters for the stored procedure here
@text varchar(200)

AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
declare @newString varchar(205)
Set @newString = '%' + @text + '%'
    -- Insert statements for procedure here
    select name from sysobjects where id in 
(select id from syscomments where text like @newString)
order by name
END
Anuncios