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

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'
                   );

 

posted @ 2019-03-14 16:33  码荣  阅读(2406)  评论(0编辑  收藏  举报