Error 431 SQL71561:
Computed Column: [dbo].[ViewAlertFrequency].[BeginDate] 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:
[Lookup].[dbo].[AlertFrequency].[AlertFrequency]::[BeginDate]
or [Lookup].[dbo].[AlertFrequency].[BeginDate]
当前数据库是Lookup,因此找不到此对象应该没有任何问题。这是从现有视图导入的。似乎整个数据库都是这样的。我不确定:: syntax是什么。
以下是观点:
CREATE VIEW [dbo].[ViewAlertFrequency]
AS
--###
--ViewAlertFrequency
--###
--###
--used by: eobResolve
--###
SELECT DISTINCT TOP 100
AlertFrequency.[ID] AS [ID],
AlertFrequency.Code AS Code,
AlertFrequency.[Name] AS [Name],
AlertFrequency.[Description] AS [Description],
AlertFrequency.[Rank] AS [Rank],
AlertFrequency.BeginDate AS BeginDate,
AlertFrequency.EndDate AS EndDate
FROM
Lookup.dbo.AlertFrequency AS AlertFrequency
ORDER BY
AlertFrequency.[Rank] ASC
GO
GRANT SELECT
ON OBJECT::[dbo].[ViewAlertFrequency] TO [eobResolve]
AS [dbo];
答案 0 :(得分:7)
您在“FROM”子句中使用了3部分命名约定。将“Lookup.dbo.AlertFrequency”更改为“dbo.AlertFrequency”,您的问题应该消失。我的结果好坏参半。更改其中一个数据库选项似乎足以解析这些三部分名称,但后来我遇到了跨数据库引用(4部分名称)的其他问题。我想只是将3部分名称改为2部分[schema]。[object]命名将是处理它的更简单的方法。
GRANT语句只是指定将权限授予对象而不是模式。我不认为它属于对象定义,但我们在部署后脚本中处理我们的权限,因为它们在不同环境之间略有不同。