尝试动态获取存储过程中引用的对象。下面的代码在动态
时不起作用DECLARE @procname VARCHAR(50) = 'GetTempBondInformation'
SELECT QUOTENAME('dbo.' + @procname ,'''')
SELECT DISTINCT referenced_entity_name FROM sys.dm_sql_referenced_entities(QUOTENAME('dbo.' + @procname ,''''), 'OBJECT')
下面的代码工作正常。
SELECT DISTINCT referenced_entity_name FROM sys.dm_sql_referenced_entities('dbo.GetTempBondInformation', 'OBJECT')
任何线索?
答案 0 :(得分:0)
试试这个:
(删除引语)
DECLARE @procname VARCHAR(50) = 'GetTempBondInformation'
SELECT DISTINCT
referenced_entity_name
FROM
sys.dm_sql_referenced_entities('dbo.' + @procname, 'OBJECT')