SQL71501 - 如何摆脱这个错误?

时间:2023-02-19
本文介绍了SQL71501 - 如何摆脱这个错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我们在项目中使用了两个模式 (dbo + kal).

We're using two schemas in our project (dbo + kal).

当我们尝试使用以下 SQL 语句创建视图时,Visual Studio 在错误列表中显示为错误.

When we are trying to create a view with the following SQL statement, Visual Studio shows as an error in the error list.

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:计算列:[dbo].[RechenketteFuerAbkommenOderLieferantenView].[AbkommenId] 包含对对象的未解析引用.对象不存在或引用不明确,因为它可能引用以下任何对象:
[kal].[Basisrechenkette].[r]::[AbkommenId], [kal].[Rechenkette].[AbkommenId], [kal].[Rechenkette].[r]::[AbkommenId], [kal].[Rechenkettensschema].[r]::[AbkommenId] 或 [kal].[RechenketteTerm].[r]::[AbkommenId].

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 错误的混乱中丢失了.

Publishing the view and working is just fine, but its quite annoying to see the error message all the time when building our project having all the serious errors get lost in the shuffle of those sql errors.

您知道可能是什么问题吗?

Do you have any idea, what the problem might be?

推荐答案

我刚刚找到了解决方案.尽管我无法阅读您的(似乎是德语)以了解您是否指的是系统视图,但如果是,则必须提供对 master 的数据库引用.否则,添加任何其他必需的数据库引用应该可以解决问题.

I just found the solution. Although I can't read your (what appears to be German) enough to know if you're referring to system views, if so, a database reference to master must be provided. Otherwise, adding any other required database references should solve the problem.

此处针对系统视图进行了描述:解析对对象信息架构表的引用

This is described here for system views: Resolve reference to object information schema tables

和其他数据库参考.

此处提供了其他信息:解决 SQL Server SSDT 项目中的歧义引用

这篇关于SQL71501 - 如何摆脱这个错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:64 位 Microsoft SQL Server 数据工具 下一篇:如何使用开发人员计算机连接到 Azure VM SQL Server 分析服务实例

相关文章

最新文章