Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
339 views
in Technique[技术] by (71.8m points)

VS 2012 Database Project "unresolved reference to object" Error

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" 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].
question from:https://stackoverflow.com/questions/13373310/vs-2012-database-project-unresolved-reference-to-object-error

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

One other possibility is that the schema you have used in your view/table etc does not exist in the project. You may need to add the schema to the VS Database Project.

Right Click the project and Add > New Item > Schema


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...