2012-04-16 86 views
6

有沒有一種方法可以找到在SQL Server 2005數據庫中調用存儲過程的位置?如何查找存儲過程調用?

我嘗試使用查找,但這並不像在Visual Studios中那樣工作。

在此先感謝。

回答

11

如果你需要按名稱查找數據庫對象(如表,列,觸發器) - 看看所謂SQL Search免費紅門工具,它做到這一點 - 它搜索整個數據庫的任何種類的字符串(S)。

因此,在您的情況下,如果您的知道您感興趣的存儲過程的調用 - 只需在搜索框中鍵入該關鍵字,SQL Search將快速向您顯示該存儲過程的所有位置叫從。

enter image description here

enter image description here

這是一個偉大的必須具備的任何DBA或數據庫開發人員工具 - 爲什麼我已經提到它的絕對免費用於任何用途的?

+0

多少錢? =) – Yatrix 2012-04-16 16:21:23

+1

@Yatrix:**沒有** - zip,zilch,nada - niente - rien du tout - 足夠清楚了嗎? :-) – 2012-04-16 16:22:02

+1

聽起來很貴,但我可以負擔得起。謝謝。 – Yatrix 2012-04-16 16:23:55

6

您可以嘗試在SQL Server Management Studio中使用View Dependencies

右鍵單擊存儲過程並選擇View Dependencies。但是我發現它並不總是100%準確。

6

您可以創建一個 '查找' SP

我用這一個數據庫對象中搜索文本:

CREATE sp_grep (@object varchar(255)) 
as 

SELECT distinct 
'type' = case type 
when 'FN' then 'Scalar function' 
when 'IF' then 'Inlined table-function' 
when 'P' then 'Stored procedure' 
when 'TF' then 'Table function' 
when 'TR' then 'Trigger' 
when 'V' then 'View' 
end, 
o.[name], 
watchword = @object 
FROM dbo.sysobjects o (NOLOCK) 
JOIN dbo.syscomments c (NOLOCK) 
ON o.id = c.id 
where c.text like '%'[email protected]+'%'