SQL Server根据表名查询存储过程或试图

select a.name 来源名称,b.text 代码内容,
    case
        when a.xtype='V' then '视图'
        when a.xtype='P' then '存储过程'
        when a.xtype='FN' then '标量函数'
        when a.xtype='TF' then '表函数'
        when a.xtype='TR' then '触发器'
        else a.xtype
    end 类型
from sysobjects a inner join syscomments b on a.ID=b.ID
where b.text like '%须要查询的表%'
order by 类型
相关文章
相关标签/搜索