How to sync specific tables using Data Sync

Priya Jha 896 Reputation points
2023-02-16T13:15:06.9666667+00:00

Hi All,

I want to use Data Sync functionality of Azure SQL DB to sync data between 2 DB's.

Is it possible to enable sync functionality for specific tables under a schema

or for specific schema using Data Sync?

Azure SQL Database
{count} votes

2 answers

Sort by: Most helpful
  1. RahulRandive 10,486 Reputation points Volunteer Moderator
    2023-02-16T15:38:42.01+00:00

    Thanks for your question.

    Yes, it’s possible.
    Please find details below-

    You don't have to include all the tables that are in a database in a sync group. The tables that you include in a sync group affect efficiency and costs. Include tables, and the tables they are dependent on, in a sync group only if business needs require it.

    Please note, each table in a sync group must have a primary key. SQL Data Sync can't sync a table that doesn't have a primary key.

    https://learn.microsoft.com/en-us/azure/azure-sql/database/sql-data-sync-best-practices?view=azuresql#table-considerations-and-constraints

    Also, This article https://learn.microsoft.com/en-us/azure/azure-sql/database/sql-data-sync-update-sync-schema?view=azuresql introduces a solution to automatically replicate schema changes to all SQL Data Sync endpoints.

    1.      This solution uses a DDL trigger to track schema changes.

    2.      The trigger inserts the schema change commands in a tracking table.

    3.      This tracking table is synced to all endpoints using the Data Sync service.

    4.      DML triggers after insertion are used to apply the schema changes on the other endpoints.

     

    Let us know if this helps!

    Thank you!

    0 comments No comments

  2. GeethaThatipatri-MSFT 29,542 Reputation points Microsoft Employee Moderator
    2023-02-16T15:44:41.1966667+00:00

    Hi, @Priya Jha Thanks for posting your question in the Microsoft Q&A forum.

    Yes, you can enable Specific tables, what kind of schema? if that is about columns then yes it is possible.

    you can choose which columns need to be replicated when configuring sync from the portal, it will allow you to select the tables and columns directly.

    Please refer to this document for more information

    Regards

    Geetha

    0 comments No comments

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.