BACPAC: Could not import package. SQL72012

MVP

Hi SQL-guys,

 

I'm running into this error during the last days and could not find a solution:

I am trying to import a database .BACPAC file from SQL Azure into my local SQL Server.

When doing so, I get this error on my local machine:

 

Could not import package.
Warning SQL72012: The object [mydb_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 [mydb_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.

 

I found this post (among with others...):

https://www.sqlservercentral.com/Forums/PrintTopic1886371.aspx

sp_configure 'contained database authentication', 1;
GO  
RECONFIGURE;
GO

 

Interestingly, this reconfiguration worked once some days ago with another database.

 

But now, I'm stuck, it doesn't work for me.

[ I even installed the latest version of SQL Server Management Studio (SSMS) 17.2 from https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms but without success. ]

 

 

Tips anyone?

thx! Toni 

 

12 Replies
Hi all, I figured out that the reconfiguration works properly with _most_ of my databases (but not all). So it seems, the issue is dependent on the database and the authentication used in there. Need to figure out a complete solution for that...

Hi, 

 

I have the exact same problem. Done the same upgrades as you and even upgraded my local SQL Server to the latest service pack (2016 sp1).

 

Did you find any permanent solution for this? Have tried the above with no luck.

 

Br,

Fredrik

Hi Fredrik,
yes!
It turned out that when I imported the same database into another SQL Azure Server, I received the following error:

Could not import package.
Error SQL72014: .Net SqlClient Data Provider: Msg 468, Level 16, State 9, Procedure vwSomeView, Line 3
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the UNION operation.
Error SQL72045: Script execution error. The executed script:
CREATE VIEW [dbo].[vwSomeView] ...

So, this lead me to the solution. Obviously, in my database, I added some new columns and that was done in with a different collation. That caused my errors.
To make it short, my solution had 2 parts:
1. https://www.sqlservercentral.com/Forums/PrintTopic1886371.aspx
2. I needed to convert all columns to the same collation, similar as here:
ALTER TABLE MyTable ALTER COLUMN [MyColumn1] varchar(MAX) COLLATE Latin1_General_CI_AS NULL
Since this would mean a lot of effort I found a Stored Procedure script that runs through all tables and generates that ALTER script from https://stackoverflow.com/questions/18122773/change-collations-of-all-columns-of-all-tables-in-sql-s...
After These two steps, I regenerated the BACPAC and I was able to Import that database.
I hope I find some time to publish that in my blog in the next days to make a detailled description about my scenario.

Hope that helps?!
br, Toni

Thank you so much!

I used 

sp_configure 'contained database authentication', 1; GO RECONFIGURE; GO

 

to enables contained databases on the instance of the Database Engine

 

https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/contained-database-authentica...

Hello Sir..

Sir I am having the same problem....I am not able to import Bacpac file on my server instance which is sql  server 2012 version.On my Local I have SQL SERVER 2014 .I am using ssms of SQL Server 2014 to connect to my Instance 192.168.1.205.but I am getting this error.I have windows 10 on my local.I have even reconfigured for contained database. but no luck .please help me.Thanks

Same issue...and My boss is sitting on my head....

Hello Sir please tell me where do we run this reconfigure code ....on the target server where we r trying to import the bacpac file....Pls answer.Thanks

I ran the same code on target server where we r trying to import the bacpac file but again the same error.

 

 

please suggest..thanks

 

In this case, what you should do is to update the version of the sql server client, since Azure Database always works with the latest updates released by microsoft.
Perfect! It worked for me , Thanks!

@Toni Pohl Another cause of this error is trying to restore a database that has full text indexes defined in it if you do not have full text indexing installed on the server. There may also be other features this could apply to, but this is the only one I have experienced. Hopefully this will help someone.

Hi @LeeCommerce,

Thanks for sharing in formation, but this is an old thread from 2017. There is no reason to "bring it to life". If someone will have such issue then he will probably create a new thread and we will be able to help him.

@LeeCommerce 

This one worked for me. Installed full text index on SQL server and that resolved the problem.