Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with suppressing errors in SSDT (SQL Server Data Tools)

It looks like SSDT supports only suppressing warnings but not errors. I have many errors, all stating:

Error 4 SQL71561: View: [dbo].[x] has an unresolved reference to object [DB1].[dbo].[y].[column]

I do not want to reference DB1 in this database project, for specific reasons. I just want these errors to be ignore when I build the project. The only way I have been able to get ride of these errors is to go to each file (view) and set the Build Action to None. Suppressing TSql Warnings at the project level or the file level does not work (I'm assuming this only suppresses warnings). And, I have not set the option to treat T-SQL warnings as errors.

Is there a better approach?

like image 752
H A Avatar asked Mar 27 '12 17:03

H A


People also ask

How do I run a repair option in SQL Server Data Tools?

Close the SSMS application (if it is running). On the computer, go to Control Panel > All Control Panel Items > Programs and Features. From the list of programs, right click SQL Server Management Studio and click Uninstall. Click Repair to begin the SSMS install repair.

What is SQL Server Data Tools Ssdt?

SQL Server Data Tools (SSDT) is a modern development tool for building SQL Server relational databases, databases in Azure SQL, Analysis Services (AS) data models, Integration Services (IS) packages, and Reporting Services (RS) reports.


1 Answers

I haven't found how to avoid the error without referencing DB1, but there are two options to go about it if you don't have the code for it in SSDT:

  • If you have access to the live DB1, extract a .dacpac out of it using SqlPackage. Then add this .dacpac as a reference in your project.
  • Create a stub project (e.g. a fake DB1) side-by-side with yours, reference it, and add the stub objects there.

I had to use option 1 with a project a while ago, which I detailed here:

http://tangodude.wordpress.com/2014/02/05/referencing-the-sql-server-data-collectors-management-data-warehouse-in-your-ssdt-database-project/

You can extract a dacpac by using this:

SqlPackage /Action:Extract /SourceServerName:YourServerNameHere /SourceDatabaseName:YourDatabaseNameHere /TargetFile:YourDatabaseNameHere.dacpac
like image 162
Jorge Candeias Avatar answered Oct 13 '22 13:10

Jorge Candeias