Migrate Data from a Local Database to Azure – SQL Server

The easiest way to do this is using a Script generated by SQL Server Management Studio with the data we want to migrate.

Generating the Data Insertion Script

For that we must do the following:

  1. Go to our local database in SQL Server Management Studio
  2. Right click on the database
  3. Select Task> Generate Scripts …
  4. You should get the following:

4.1. If you want to extract all data from all tables, select “Script entire database and all database objects”, otherwise, select “Select specific database objects” and select the tables from which you want to extract data.

5. Press Next

6. Press Advanced.

7. In Script USE DATABASE select False, and in Types of data to script, select Data only and press Ok:

8. Select “Save to new query window” and press Next twice.

9. Press Finish

Inserting the Data in the Azure Database

We are then going to insert this data into the Azure database. One way to do this is to go to the database in Azure and run the script right there.

  1. Go to https://portal.azure.com/
  2. Go to your database.
  3. Click on Query Editor (preview)
  4. Enter your credentials. If you get an IP message, click on the link below:

5. Click Ok to enter your database.

6. In the Queries Editor, place the query and press Run:

That’s it, with this you have inserted the desired data in Azure.

Courses

If you want to learn more about software development, buy one of my courses today:

  1. Building Applications with React 17 and ASP.NET Core 6: https://www.udemy.com/course/building-applications-with-react-and-aspnet-core/?couponCode=SEPTEMBER2021
  2. Building Applications with Angular 11 and ASP.NET Core 5: https://www.udemy.com/course/building-applications-with-angular-and-aspnet-core/?couponCode=SEPTEMBER2021
  3. Programming in Blazor – ASP.NET Core 5: https://www.udemy.com/course/programming-in-blazor-aspnet-core/?couponCode=SEPTEMBER2021
  4. Building RESTful Web APIs with ASP.NET Core 3.1: https://www.udemy.com/course/building-restful-web-apis-with-aspnet-core/?couponCode=SEPTEMBER2021
  5. Introduction to Concurrency in C# – Async and Paralellism: https://www.udemy.com/course/introduction-to-concurrency-in-c-async-and-paralellism/?couponCode=SEPTEMBER2021

Kind regards!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s