Мы переносим новую базу данных SQL Server 2017 в Azure. Сегодня мы запустили помощника по миграции данных Microsoft в режиме оценки для перехода с SQL Server на базу данных SQL Azure. Мы пытаемся разрешить неразрешенную ссылку на объект. Это не должно считаться кросс-запросом БД. Представление работает нормально в нашем локальном экземпляре.
В разделе «Рекомендации по оценке» есть этот блок:
{ "CompatibilityLevel": "CompatLevel140",
"Category": "Compatibility",
"Severity": "Error",
"ChangeCategory": "MigrationBlocker",
"RuleId": "71501",
"Title": "Unresolved references found",
"Impact": "One or more objects were found that contain unresolved references, which may block migration to Azure SQL Database.",
"Recommendation": "Address the unresolved references reported in \"Object details\" section.",
"MoreInfo": "",
"ImpactedObjects": See below... }
Для хранимой процедуры dbo.VW_BUILD_PARAMETERS
в ImpactedObjects есть следующие зарегистрированные проблемы:
{
"Name": "dbo.VW_BUILD_PARAMETERS.IsOutPutParameter",
"ObjectType": "Computed Column",
"ImpactDetail": "Computed Column: [dbo].[VW_BUILD_PARAMETERS].[IsOutPutParameter] contains an unresolved reference to an object. Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects: [sys].[objects].[P]::[is_output], [sys].[parameters].[is_output] or [sys].[parameters].[P]::[is_output]. For more details, please see: Line 18, Column 1.",
"SuggestedFixes": []
},
{
"Name": "dbo.VW_BUILD_PARAMETERS.ObjectName",
"ObjectType": "Computed Column",
"ImpactDetail": "Computed Column: [dbo].[VW_BUILD_PARAMETERS].[ObjectName] contains an unresolved reference to an object. Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects: [sys].[objects].[Name], [sys].[objects].[SO]::[Name] or [sys].[parameters].[SO]::[Name]. For more details, please see: Line 5, Column 8.",
"SuggestedFixes": []
},
{
"Name": "dbo.VW_BUILD_PARAMETERS.ParameterOrder",
"ObjectType": "Computed Column",
"ImpactDetail": "Computed Column: [dbo].[VW_BUILD_PARAMETERS].[ParameterOrder] contains an unresolved reference to an object. Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects: [sys].[objects].[P]::[parameter_id], [sys].[parameters].[P]::[parameter_id] or [sys].[parameters].[parameter_id]. For more details, please see: Line 14, Column 1.",
"SuggestedFixes": []
},
Вот хранимая процедура:
CREATE VIEW [dbo].[VW_BUILD_PARAMETERS]
AS
SELECT SO.Name AS [ObjectName],
CASE SO.Type_Desc
WHEN 'SQL_STORED_PROCEDURE'
THEN 'Procedure'
WHEN 'SQL_SCALAR_FUNCTION'
THEN 'Function'
WHEN 'SQL_INLINE_TABLE_VALUED_FUNCTION'
THEN 'Function'
END AS [ObjectType],
P.parameter_id AS ParameterOrder,
REPLACE( P.name, '@','') AS ParameterName,
UPPER(TYPE_NAME(P.system_type_id)) AS ParameterType,
CASE
WHEN TYPE_NAME(P.user_type_id) = 'varchar'
THEN CAST(P.max_length AS INT)
END AS MaximumCharacterLength,
P.is_output AS [IsOutPutParameter]
FROM sys.objects AS SO
INNER JOIN sys.parameters AS P
ON SO.OBJECT_ID = P.OBJECT_ID
WHERE SO.type IN ('P','FN','IF')
AND P.parameter_id > 0
Я не вижу, как 'P.parameter_id AS ParameterOrder'
неразрешима среди:
[sys].[objects].[P]::[parameter_id]
- Почему он пытается сделать псевдоним P для sys.objects? Нет sys.objects.parameter_id.
[sys].[parameters].[P]::[parameter_id]
- Похоже, это должно совпадать
[sys].[parameters].[parameter_id]
- Почему он не соответствует псевдониму P