[转载]SQL Server查找包含某关键字的存储过程3种方法
存储过程都写在一个指定的表中了,我们只要使用like查询就可以实现查询当前这台SQL Server中所有存储过程中包括了指定关键字的存储过程并显示出来,下面一起来看看我总结了几条命令。
例子1
代码如下
OBJECT_NAME(id),id from syscomments
where id in
( select object_id(name) from dbo.sysobjects where xtype='P'
)
and text like '%FieldName%'
id
例子2
在SQL Server 2005/2008中,查询包含某关键字的存储过程语句:
代码如下
select distinct b.name
from dbo.syscomments a, dbo.sysobjects b
where a.id=b.id  and b.xtype='p' and a.text like '%text%'
order by name
例子3
关键字查找相关的存储过程、、函数和视图
代码如下
select name,type_desc from sys.all_sql_modules s 
inner join sys.all_objects o on s.object_id=o.object_id 
where definition like '%key%' order by type_desc,name
[转载请保留作者信息 作者:冯天文 ]
 
                    
                
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号