系统查找存储过程和触发器

功能:快速查找存储过程和触发器
参数:@name,存储过程名或者触发器名
      @type,类型,'sp'为存储过程,'Tr'为触发器
create function Query_Object(@name varchar(100), @type varchar(2))
RETURNS TABLE
as
return(select b.name ,a.text from syscomments a,sysobjects b
 where object_id(b.name)=a.id and b.xtype=@type and b.name=@name)
--测试
select * from Query_Object('sql_Object','sp')
--利用系统存储过程查看:
sp_helptext  sql_Object
原文地址:https://www.cnblogs.com/Luouy/p/2032535.html