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
——————————

Unshelve Pending Changes in Visual Studio 2013

Recently, I needed to use visual studio 2013 for a client who is still using it and need to shelve and unshelve a changeset. Shelving is easy but I couldn’t find an intuitive way to unshelve my changes. After stumbling for a few minutes and a couple of failed google searches I finally found it.

1. Go to Team Explorer
2. Locate the Pending Changes section
3. Right click on Pending Changes and click on the “Find Shelvesets” menu item.
4. Once you are on the Find Shelvesets screen you can do a search by the user name or shelveset name.

Locate Pending Changes Section:
visual-studio-2013-shelveset-1

Search for shelveset by user name or shelevset name:
Visual-Studio-2013-Shelveset-2

Instead of step 3, you can also just click on the Pending Changes section and locate “Find Shelvesets” in the “Actions” drop down.
Visual-Studio-2013-shelveset-3