Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import Azure SQL backup (.bacpac) to LocalDB using Visual Studio?

I imagine this would be quite a mainstream scenario but I can't find how to import an exported Azure SQL database (.bacpac) into my LocalDB in Visual Studio 2013. Am I missing something or Visual Studio missing something?

(Note: there are solutions here when one has SQL Server management studio but I don't have it and prefer not to install it, if possible.)

like image 719
Borek Bernard Avatar asked Jan 08 '15 22:01

Borek Bernard


People also ask

How do I connect to Azure SQL Database from Visual Studio code?

In Visual Studio Code, press Ctrl+Shift+P (or F1) to open the Command Palette. Select MS SQL:Connect and choose Enter. Select Create Connection Profile. Follow the prompts to specify the new profile's connection properties.

How do I link my Azure SQL Database to Visual Studio 2019?

Open your project in Visual Studio. In Solution Explorer, right-click the Connected Services node, and, from the context menu, select Add Connected Service. In the Connected Services tab, select the + icon for Service Dependencies. In the Add Dependency page, select Azure SQL Database.


1 Answers

If you have this folder on your machine C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin then you can run this command to restore the bacpac file:

.\SqlPackage.exe /Action:Import /SourceFile:"c:\temp\your.bacpac" /TargetConnectionString:"Data Source=(localdb)\v11.0;Initial Catalog=devdb; Integrated Security=true;" 

If that folder's missing you will need to download the tooling from Microsoft.

like image 113
Simon W Avatar answered Oct 05 '22 13:10

Simon W