Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unresolved references in Microsoft Visual Studio SQL Database project

I have a MS DataBase project in Visual Studio -- after doing a Schema Comparison, I am trying to generate a deploy script, the problem is I get hundreds of Unresolved references errors,such as the following two:

Error   385 TSD03006: View: [auditing].[AuditedEntities] has an unresolved reference to object [INFORMATION_SCHEMA].[REFERENTIAL_CONSTRAINTS].  D:\greatProject\Database\greatProject.Database\Schema Objects\Schemas\auditing\Views\AuditedEntities.view.sql   4   14  greatProject.Database
Error   387 TSD03006: View: [auditing].[AuditedEntities] 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: [INFORMATION_SCHEMA].[REFERENTIAL_CONSTRAINTS].[C]::[CONSTRAINT_NAME], [INFORMATION_SCHEMA].[REFERENTIAL_CONSTRAINTS].[CONSTRAINT_NAME] or [INFORMATION_SCHEMA].[TABLE_CONSTRAINTS].[C]::[CONSTRAINT_NAME].  D:\greatProject\Database\greatProject.Database\Schema Objects\Schemas\auditing\Views\AuditedEntities.view.sql   5   69  greatProject.Database

The SPROCS never have issues when they run. Is there a quick and dirty way to fix this? Perhaps even by turning off referential integrity checks perhaps?

like image 208
Matt Avatar asked Nov 17 '10 02:11

Matt


1 Answers

Your database project is missing a reference to the master database.

Assuming that you are talking about a SQL Server Data Tools (SSDT) database project, you can add the missing reference as follows:

  1. In Solution Explorer, open the context menu on the References node and select Add Database Reference… from it:

    Add database reference via Solution Explorer

  2. In the upper portion of the opening dialog window, select the System database option and choose master from the dropdown list.

    Select the System database <code>master</code>

  3. Finally, press the OK button. The database reference should now be added to your project.

like image 97
stakx - no longer contributing Avatar answered Oct 05 '22 10:10

stakx - no longer contributing