Jondlm
Jondlm

Reputation: 8892

Unresolved Reference Error SQL71561 with SQL Server Data Tools 2010

I am getting an error when using SSDT 2010 (latest updates, v10.3.21208.0) with multiple database projects in a single solution. The error reads the following:

SQL71561: View: [dbo].[View] has an unresolved reference to object [OtherDatabase].[dbo].[OtherTable]

I've read all the other resources I could find on Stack Overflow and Google. Here are some things I've already tried:

Nothing seems to be working for me. Any help would be much appreciated. Here is a screenshot that might shed more light on my problem:

Image showing my visual studio window with the error

Upvotes: 3

Views: 10375

Answers (3)

Flora
Flora

Reputation: 119

It has been a while, but I still want to share this solution with others that may be following the same lost links I was initially. Pay close attention to step 4. That cleared the issue for me.

A possible solution is to add a database reference to the database that has the missing object. The reference needs a Data-tier Application (dacpac file) that can be easily generated on the solution with the database project that has the missing object. Press the right mouse button over the database project and selected Snapshot Project. The dacpac file is created on the Snapshots folder. The file should then be copied to a common folder for re-usability.

In the project with the error press the right mouse button over the References and selected Add Database Reference. The Add Database Reference dialog appears:

  1. Select the dacpac file
  2. Select the database location. The most common option is "Different database, same server"
  3. Confirm that the Database name field is as expected
  4. Clear the "Database variable" field in the dialog. If this field has a value the queries must use this variable and not the database name

Upvotes: 9

adam0101
adam0101

Reputation: 31085

I'm using VS2015, but it might still apply. In my case, the referenced database had a "Database Variable Name" specified in the reference properties like $(SomeDb). If someone tried to refer to an item in the referenced database using the actual database name instead of the variable, we'd get a warning about an unresolved reference. Changing those to be like [$(SomeDb)].[dbo].[SomeTable] resolved the references.

Upvotes: 0

tekumara
tekumara

Reputation: 8817

If the referenced database project builds, but the reference isn't resolving, try cleaning and rebuilding the referenced project and cleaning the project doing the referencing.

Upvotes: 1

Related Questions