Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have made a backup of my SQL Azure in a bacpac file and when I try to import the bacpac in localdb it always fail.

Here is the command I use:

PS C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin> .\SqlPackage.exe /Action:Import 
/TargetConnectionString:"Data Source=(localdb)\v11.0;Initial Catalog=MyDb; Integrated Security=true;"

And here is the error message:

*** Error importing database:Data cannot be imported into target because it 
contains one or more user objects. Import should be performed against a new, empty 
Error SQL0: Data cannot be imported into target because it contains one or more
user objects. Import should be performed against a new, empty database.

My machine is newly installed, and I have never used localdb at all.

share|improve this question
have you tried different localdb names? – swasheck Oct 28 '13 at 14:40
Actually, I made it working, I try to repodruce my mistake and will update information here. It was not coming from the name. It seems that VS2013 added the mdf file to the wrong place when I created the database. – Swell Oct 28 '13 at 15:23
up vote 0 down vote accepted

I had the problem on another machine today and solved it like that:

Before doing this make sure to backup all other database

Delete this directory

C:\Users\{your user name}\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0

Then open a command prompt

cd "C:\Program Files\Microsoft SQL Server\110\Tools\Binn"
sqllocaldb.exe delete v11.0

And after that everything went fine...

share|improve this answer

I encountered this problem and, after some frustration, solved it.

What had happened is that you have created, most likely by mistake, a user object in the model Database. On Management Studio look under Databases\System Databases\model. This is the template that is used when you create a new database, and is used when importing the bacpac. If there are objects (such as a table) in the model, they are automatically created at the same time as the new database. The bacpac import then encounters them in what it expects to be a blank database, and so immediately fails.

You'll also see these same objects created if you manually create a new database.

Deleting the object(s) from the model database solves the problem.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.