欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

SQL SERVER 查看所有存储过程或视图里 包含某个关键字的查询语句

程序员文章站 2022-05-18 23:19:16
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 '%关键字%' ORDER BY typ... ......
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 '%关键字%'
order by type_desc, name;
select name, xtype from sysobjects o, syscomments s
where o.id = s.id and text like '%agent%';
--查询所有包含某列名的对象
select name,
       object_id,
       type,
       type_desc
from sys.objects
where object_id in (
                       select object_id from sys.columns where name = 'serverid'
                   );