0
votes

I have created a bacpac file through the Export option of Azure.

Then, I tried to import the bacpac file into SQL Server installed locally on my pc, selecting in SQL Server Management Studio, the “Import Data-tier Application…” feature.

The import fails becouse the destination version of sql server is not the same of the source (namely from Sql Azure to SQL Server 2014). I have in fact locally installed on my pc SQL Server 2014.

To fix the problem I should create a new SQL Server database project in Visual Studio 2017, remove some incompatibilities like the following:

--CREATE DATABASE SCOPED CREDENTIAL
--    WITH IDENTITY = N'SHARED ACCESS SIGNATURE';

Then I should publish the project to create a new db locally.

But the new db obtained publishing the Visual Studio Project is empty and so I have to manually copy the data, cause the Import Data function in SSMS doesn’t work because of some problems like column identity.

Is there a quick and simple way of creating a local copy of a SQL Azure Database on my local SQL Server?

Thanks

1

1 Answers

1
votes

You can try the below steps and see if it helps,

  1. Open your SQL Management Studio and connect to your Azure SQL Server.
  2. Select the database you would like to get down onto your local machine and right-click -> select "Generate Scripts". Follow the prompts.

If you want the data as well as the scripts, you need to check the Advanced Options before beginning the generating. Scroll down to "Types of data to script" and make sure you have "Schema and data" or whatever is appropriate for you. You will get a SQL script file. Then you can run that on your local machine and it will create a database with all the data.