VS 2012数据库项目“对象的未解析引用”错误 [英] VS 2012 Database Project "unresolved reference to object" Error
问题描述
我在VS 2012&导入我们的数据库。
当我构建项目时,我得到了很多未解析的对象引用错误。
这些错误只适用于我在数据库中的几个视图。
这些视图的语法是正确的&我不使用临时表。
我应该检查什么才能解决这个问题?
I created SQL Server Database Project in VS 2012 & imported our database. When I build the project, I get a lot of "unresolved reference to object" Errors. These errors are only for a few views I have in my database. The syntax for these views are correct & I am not using temp tables. What should I check to solve this issue?
更新:
这是一个例子:
UPDATE: This is one example:
CREATE view [Factory].[NonStartedOrders]
as
SELECT
"Customers"."CustomerName", "Customers"."CustomerAName",
"Customers"."MarketID",
"Orders"."OrderID",
"Orders"."ApproveDate",
"FactoryOrders"."FactoryID",
"FactoryOrders"."EstEndDate",
"FactoryOrders"."StatusID",
"FactoryOrders"."TotalWeight",
"Karats"."KaratEName"
FROM (("Taiba"."Sales"."FactoryOrders" "FactoryOrders"
INNER JOIN "Taiba"."Sales"."Orders" "Orders" ON "FactoryOrders"."OrderID"="Orders"."OrderID")
INNER JOIN "Taiba"."General"."Customers" "Customers" ON "Orders"."CustomerID"="Customers"."CustomerID")
INNER JOIN "Taiba"."MasterPiece"."Karats" "Karats" ON "Orders"."MKaratID"="Karats"."KaratID"
Taiba这里是我的数据库名称。
我只有这个视图获得30个错误。
这些是他们的一些错误:
"Taiba" here is my database name. I am getting 30 errors only for this view. These are a few errors of them:
Error 217 SQL71561: View: [Factory].[NonStartedOrders] has an unresolved reference to object [Taiba].[Sales].[FactoryOrders]
Error 219 SQL71561: View: [Factory].[NonStartedOrders] 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: [Taiba].[Sales].[FactoryOrders].[FactoryOrders]::[OrderID], [Taiba].[Sales].[FactoryOrders].[OrderID] or [Taiba].[Sales].[Orders].[FactoryOrders]::[OrderID].
推荐答案
我解决了这个问题。
似乎我的一些意见/ SPs使用这个命名约定(3部分限定名)引用了表:
It seems a few of my views/SPs has referenced the tables using this naming convention ( 3 parts qualified name ):
DatabaseName。 SchemaName.TableName
DatabaseName.SchemaName.TableName
我将所有引用更改为以下内容:
I changed all references to be as the following:
SchemaName.TableName
SchemaName.TableName
这篇关于VS 2012数据库项目“对象的未解析引用”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!