一聚教程网:一个值得你收藏的教程网站

热门教程

SQL Server查找包含某关键字的存储过程3种方法

时间:2022-06-29 07:57:08 编辑:袖梨 来源:一聚教程网

例子1

 代码如下 复制代码

select OBJECT_NAME(id),id from syscomments
where id in
( select object_id(name) from dbo.sysobjects where xtype='P'
)
and text like '%FieldName%'
group by 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 '%keyword%' order by type_desc,name

热门栏目