Take the 2-minute tour ×
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. It's 100% free, no registration required.

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 
/SourceFile:"C:\Users\S\Desktop\MyDb.bacpac" 
/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 
database.
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
2  
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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.