用SQL語句查找包含有某個關鍵字的存儲過程、觸發器、函數等等,SQL語句以下:函數
select OBJECT_NAME(id) as 存儲過程,id from syscomments where id in ( select object_id(name) from dbo.sysobjects where xtype='P' --存儲過程爲P ) and text like '%FieldName%' --關鍵字 group by id
或spa
select name from sysobjects o, syscomments s where o.id = s.id and text like '%Extent1%' --and o.xtype = 'P'