有没有方法可以在SQL Server 2005数据库中找到存储过程被调用的位置?我尝试使用Find,但它不像在Visual Studios中那样工作。谢谢提前。
您可以创建一个“查找”存储过程
我使用这个来搜索数据库对象中的文本:
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 '%'+@object+'%'
select *
from sys.dm_sql_referencing_entities('[SchemaName].[SPName]', 'OBJECT');