SQL Azure bacpac – Import Data-tier Application Operation Failed

When importing a Exported SQL Azure DB to a local SQL server instance you may see this error. In short the reason for this error is that the DB being exported was in active use at the time of the export. The data in the Database was active changing as Azure was exporting it and this can cause data inconsistency. The export functionality does not guarantee transactional consistency.
If there are foreign key relationships between tables and there is inconsistency in the table data, the import will show an error when foreign key constraints are being re-nabled after the import.

How to fix/avoid this problem?
1. Fix the offending data rows
2. Make a copy of the Azure DB and export from the copy. The copy function essentially takes a snapshot of the DB and gurantees transactional consistency. Obviously, the bacpac export file won’t have all the data after the copy was created.

TITLE: Microsoft SQL Server Management Studio
——————————

Could not import package.
Warning SQL72012: The object [CRTM_Demo_Data] exists in the target, but it will not be dropped even though you selected the ‘Generate drop statements for objects that are in the target database but that are not in the source’ check box.
Warning SQL72012: The object [CRTM_Demo_Log] exists in the target, but it will not be dropped even though you selected the ‘Generate drop statements for objects that are in the target database but that are not in the source’ check box.
Error SQL72014: .Net SqlClient Data Provider: Msg 547, Level 16, State 0, Line 3 The ALTER TABLE statement conflicted with the FOREIGN KEY constraint “FK_dbo.Address_dbo.CoolRunningsBaseType_Id”. The conflict occurred in database “CRTM_Demo”, table “dbo.CoolRunningsBaseType”, column ‘Id’.
Error SQL72045: Script execution error. The executed script:
PRINT N’Checking constraint: FK_dbo.Address_dbo.CoolRunningsBaseType_Id [dbo].[Address]’;

ALTER TABLE [dbo].[Address] WITH CHECK CHECK CONSTRAINT [FK_dbo.Address_dbo.CoolRunningsBaseType_Id];

(Microsoft.SqlServer.Dac)

——————————
BUTTONS:

OK
——————————

SSRS – The Application is not installed message in Visual Studio 2015

Every once in a while I get to dabble with SSRS. This time I needed to edit some SSRS reports in an SSRS project that a co-worker had added to our Visual Studio solution. When I opened the solution the SSRS project failed to load with the message “{ProjectName} Incompatible” “The application is not installed”.
TLDR: You need to install SQL Server Data Tools Preview in Visual Studio 2015 from here.

ssrs-project-application-not-installed-visual-studio-2015-error

Apparently, I needed to install the Microsoft SQL Server Data Tools – Business Intelligence for Visual Studio from here.

I ended up downloading the iso which is 171 MB. Running the SSDTSETUP.exe ran the installer and finished without any issues.
microsoft-sql-data-tools-2015

Reopening Visual Studio did not fix it :-(. I was still getting the same “The application is not installed project”. It turns out that the latest version of SQL Server Data Tools for Visual Studio 2015 does not have the BI template for visual studio and we will need to install the previous version of it from here.

Update:I tried the Microsoft SQL Server Data Tool – Business Intelligence for Visual Studio 2013 from here.
Still getting the same issue. FYI, there is no separate x64 version of the SSDT installer. You may get an error that says “Rule evaluation message: The CPU architecture of installing feature(s) is different than the instance specified. To continue, add features to this instance with the same architecture.”. You need to install SSDT-BI as a new instance instead of adding features to an existing instance. The error message is completely wrong but luckily we only do this kind of stuff rarely.

SSDT-2013-New-Installation

Still no luck. I am going to try the preview version of the SSDT Visual Studio 2015 tool.s

Update: Trying SQL Server Data Tools Preview in Visual Studio 2015 from here.

SQL-Server-Data-Tools-Preview-Visual-Studio-2015

I needed to restart after the installation completed and voila it worked.