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 類型
相關文章
相關標籤/搜索