存储过程都写在一个指定的表中了,咱们只要使用like查询就能够实现查询当前这台SQL Server中全部存储过程当中包括了指定关键字的存储过程并显示出来,下面一块儿来看看我总结了几条命令。sql
例子1markdown
代码以下函数
OBJECT_NAME(id),id from syscomments where id in ( select object_id(name) from dbo.sysobjects where xtype='P' ) and text like '%FieldName%' id
例子2code
在SQL Server 2005/2008中,查询包含某关键字的存储过程语句:blog
代码以下it
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
例子3io
关键字查找相关的存储过程、、函数和视图class
代码以下module
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