How to copy table data between Azure SQL Databases

2019-09-18 | Toni Pohl

Working with Azure SQL Databases is handy. Just, how can I copy data from one Azure SQL database to another database? See the best practice here.

I had such a use case. I needed to copy a table (all rows) from a source database to a destination database with SQL Management Studio. The table did not have much data, but extensive data with varchar(MAX) fields containing HTML and Base64 encoded images. So, a copy in the edit mode via clipboard did not work.


In my sample, I needed to copy all rows from table "Newsletters" in source database "governance365" to the destination database "governancetoolkit365". Table "Newsletters" already existed in the destination database (the table creation this could be scripted as well…).

So, this method is a little bit hidden. Here´s the quick How to copy data from one database to another database in Azure SQL Databases with SQL Management Studio.

  1. Right click the source database and select "Generate Scripts…"
  2. Click "Next" and skip the introduction. Click "Select specific database objects" and select the desired table "Newsletters" and "Next".
  3. Now comes the important, "Advanced" part: Generate a script by selecting the output to a file, to the clipboard or to a new query window. Click on "Advanced" and in the option "Types of data to script", select "Data only" as shown here. Click "OK".
    Select the "Types of data to script" as needed…
  4. Now confirm the script generation with "Next".
  5. The script has been generated. Click "Finish" to close the wizard. In my sample, I got the generated script in a new query window in the background as shown here.
  6. Open a new query window in the destination database.
  7. Then, copy the generated script into the destination query windows and execute it (F5). Done!
  8. Check the result. All data should be available in the destination database in the table.

I hope this quick step-by-step article helps to quickly copy data between multiple Azure SQL databases.

Categories: Azure, Developer, English, Microsoft, SQL Server