存儲過程都寫在一個指定的表中了,咱們只要使用like查詢就能夠實現查詢當前這臺SQL Server中全部存儲過程當中包括了指定關鍵字的存儲過程並顯示出來,下面一塊兒來看看我總結了幾條命令。sql
例子1markdown
代碼以下函數
OBJECT_NAME(id),id from syscomments where id in ( select object_id(name) from dbo.sysobjects where xtype='P' ) and text like '%FieldName%' id
例子2code
在SQL Server 2005/2008中,查詢包含某關鍵字的存儲過程語句:blog
代碼以下it
select distinct b.name from dbo.syscomments a, dbo.sysobjects b where a.id=b.id and b.xtype='p' and a.text like '%text%' order by name
例子3io
關鍵字查找相關的存儲過程、、函數和視圖class
代碼以下module
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 '%key%' order by type_desc,name