use master
go

if object_id('master..sp_search') is not null begin
 drop proc sp_search
end
go


create proc sp_search
(
@searchText varchar(100)
, @type int = 0
)
as
if @type <> 1 begin
select  a.name
from sysobjects a
where exists
        (select *
                from syscomments
                where a.id = id
                and text like '%' + @searchText + '%'
        )
and xtype ='P' and category =0
end else begin
select  a.name
from sysobjects a
where exists
        (select *
                from syscomments
                where a.id = id
                and text like '%' + @searchText + '%'
        )
and (xtype ='V') and category =0
end

+ Recent posts