How to merge Azure SQL Databases

Jim Derry 146 Reputation points
2023-03-10T18:21:05.1933333+00:00

Hello,

We have an Azure SQL Database that we use as our target database (DB) for production use. We want to merge data from a new source DB into the target DB. The source and target are both SQL, but have different Schemas. The Source DB originates in a local environment.

Our plan coming in was to migrate the source into the cloud on the same server as the target and then use Insert statements to move the data into the target.

From what I have learned, this is not possible for Azure SQL.

My question is, how am I going to get the data from the source to the target in Azure? I will have to write queries to map specific columns in the source to the correct columns in the target as I go.

Thanks for your help!

Azure SQL Database
0 comments No comments
{count} votes

Accepted answer
  1. Alberto Morillo 34,671 Reputation points MVP Volunteer Moderator
    2023-03-10T19:52:31.44+00:00

    You can use Azure Functions as intermediary layer and here you will find detailed instructions.

    Alternatively, you can use DML triggers to do the same.


1 additional answer

Sort by: Most helpful
  1. Oury Ba-MSFT 20,911 Reputation points Microsoft Employee Moderator
    2023-03-10T22:35:25.24+00:00

    @Jim Derry Thank you for your reach out.

    My understanding is that you are trying to migrate your local DB to an Azure SQL database. In addition to @Alberto Morillo answer you can use the copy activity tool in ADF or the Data Migration extension in Azure Data studio if you are not concerned about the downtime.

    See link below on how that can be achieved.

    Tutorial: Migrate SQL Server to Azure SQL Database (preview) offline in Azure Data Studio

    Move data from a SQL Server database to SQL Database with Azure Data Factory

    Migrate on-premises SQL Server or SQL Server on Azure VMs to Azure SQL Database using the Data Migration Assistant

    Create an Azure SQL assessment.

    Please let us know if that answers your question.

    Regards,

    Oury

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.