T-sql 查询系统表 获取所有对象的定义sql语句

SELECT DISTINCT
       o.name AS Object_Name,
       o.type_desc
  FROM sys.sql_modules m
       INNER JOIN
       sys.objects o
         ON m.object_id = o.object_id
 WHERE m.definition Like '%/15/%' and type_desc like 'SQL_STORED_PROCEDURE'


看来 sys.sql_modules 是它所在的DB的view、SP等对象的定义语句所存放的表

posted @ 2016-11-23 14:40  爱知菜  阅读(13)  评论(0编辑  收藏  举报