SQLTeam.com | Weblogs | Forums

SQL71561 Unresolved Reference Error in DB project Visual Studio


Hi Team,

I just imported a database for my SQL server DB project. In that few queries are used 3 part object reference syntax. Which is referencing the same database. When I am compiling it gives me the below error

SQL71561: view [view Name ]has an unresolved reference on [table name]


Database name : TestDB

View Name : TestView

Table Name: TestTable

Error in view descrription : Select * from TestDB.dbo.TestTable

Here the 3 part "TestDB.dbo.TestTable" giving me the error though still from the same database. It is not a cross db query.


Dunno if its a workable solution for you, but couldn't you take the [TestDB] out of the VIEW definition (if the VIEW is targeting "current database" ?

We don't use any 3-part (nor 4-part) naming ANYWHERE. If we ever have to move a database we would have to rework all the code that used that reference :frowning: , so whenever we reference an external database, or a database on another server, we create a SYNONYM and use that instead; if the referenced database changes, or is moved to another server, we just have to freshen-up the Synonyms - no other code changes needed :slight_smile:


Hi Kristen,

Thanks for your reply, Our problem is we are migrating the DB server. so the requirement is not to change the production script.

And we are not moving the database we are just creating the DB project in Visual Studio for the current production script.