SQL存储过程相关信息查看转

原文地址:http://www.cnblogs.com/minideas/archive/2009/10/29/1591891.html

 

--1、查看所有存储过程与函数
     exec sp_stored_procedures
    或者
     select * from dbo.sysobjects where OBJECTPROPERTY(id, N'IsProcedure') = 1 order by name
--2、查看存储过程的内容   
   select text from syscomments where id=object_id('存储过程名称')
   -- 或者用
   sp_helptext  存储过程名称

--3、查看存储过程的参数情况
   select '参数名称' = name,
         '类型' = type_name(xusertype),
         '长度' = length,   
         '参数顺序' = colid,
         '排序方式' = collation
   from    syscolumns
   where   id=object_id('存储过程名称')

 

--4、查看所有存储过程内容
   select   b.name   ,a.text   from   syscomments   a,sysobjects   b   where   object_id(b.name)=a.id   and   b.xtype   in('P','TR')

--5、查看包含字符串内容的存储过程

select   b.name   ,a.text   from   syscomments   a,sysobjects   b
where
charindex('字符串内容',a.text)>0    and
object_id(b.name)=a.id   and   b.xtype   in('P','TR')

原文地址:https://www.cnblogs.com/suizhikuo/p/4226253.html