当我们尝试使用以下sql语句创建视图时,Visual Studio在错误列表中显示为错误.
CREATE VIEW [dbo].[RechenketteFuerAbkommenOderLieferantenView] AS SELECT r.Id as RechenkettenId,r.AbkommenId,r.LieferantId,rTerm.GueltigVon,rTerm.GueltigBis,rs.Bezeichnung,rs.As400Name FROM [kal].[Rechenkette] r JOIN [kal].[RechenketteTerm] rTerm ON rTerm.RechenketteId = r.Id JOIN [kal].[Basisrechenkette] br ON rTerm.BasisrechenketteId = br.Id JOIN [kal].[Rechenkettenschema] rs ON rs.Id = br.Id WHERE r.RechenkettenTyp = 0
错误消息如下所示:
sql71501: Computed Column: [dbo].[RechenketteFuerAbkommenOderLieferantenView].[AbkommenId] 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:
[kal].[Basisrechenkette].[r]::[AbkommenId],[kal].[Rechenkette].[AbkommenId],[kal].[Rechenkette].[r]::[AbkommenId],[kal].[Rechenkettenschema].[r]::[AbkommenId] or [kal].[RechenketteTerm].[r]::[AbkommenId].
发布视图和工作是很好的,但是在构建我们的项目时看到错误消息非常烦人,因为所有严重的错误都会在这些sql错误的混乱中丢失.
你有什么想法,问题可能是什么?
解决方法
此处描述了系统视图:Resolve reference to object information schema tables
和for other database references.
其他信息请参见:Resolving ambiguous references in SSDT project for SQL Server