SQL71501 - 如何摆脱这个错误?

SQL71501 - How to get rid of this error?(SQL71501 - 如何摆脱这个错误?)
本文介绍了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 - 如何摆脱这个错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Sending parameters to stored procedures vb.net(将参数发送到存储过程 vb.net)
Insert multiple rows, count based on another table columns(插入多行,根据另一个表列计数)
How to hold the location of an image in a SQL Server database?(如何在 SQL Server 数据库中保存图像的位置?)
How to send to email (outlook) the selected items in SQL Server database using vb.net(如何使用 vb.net 将 SQL Server 数据库中的选定项目发送到电子邮件(Outlook))
datagrid checkbox writes Null instead of 0 (false) into database(datagrid 复选框将 Null 而不是 0 (false) 写入数据库)
DBCC CheckDb-any ways to detect errors vb.net?(DBCC CheckDb-vb.net 有什么检测错误的方法吗?)