0
我想查找所有對DB對象列表的直接和間接引用。查找引用另一個存儲過程的所有存儲過程
我正在使用下面的查詢,但我發現了這個問題。
DECLARE @Search varchar(255)
SET @Search = 'Employee'
; WITH CTE AS
(
SELECT DISTINCT
o.name AS Object_Name, o.type_desc
FROM
sys.sql_modules m
INNER JOIN
sys.objects o ON m.object_id = o.object_id
WHERE
m.definition LIKE '%' + @Search + '%'
UNION ALL
SELECT
o.name AS Object_Name, o.type_desc
FROM
sys.sql_modules m
INNER JOIN
sys.objects o ON m.object_id = o.object_id
INNER JOIN
cte AS c ON c.Object_Name = o.name
)
SELECT *
FROM Cte
但我得到一個錯誤:
消息530,級別16,狀態1,第3行
聲明終止。報表完成前,最大遞歸100已用盡。
的[最大遞歸100已經語句完成之前用盡]可能的複製(http://stackoverflow.com/questions/9650045/the-maximum-遞歸-100-過氣枯竭前方的語句完成) – Prisoner