Answered by:
SQL Data Sync require GUID/UUID for primary key field?

Question
-
I want to use SQL Data Sync to perform bi-directional syncing of data between an Azure SQL database and an SQL database hosted elsewhere. For this to work, do the primary key fields on my tables need to use UUIDs instead of int? Thanks in advance.Tuesday, November 14, 2017 10:08 PM
Answers
-
Ok, so I believe that the answer to my question is "no". A GUID primary key is not required to ensure uniqueness when syncing data between table(s) using Azure Data Sync. Thanks for your help.
- Marked as answer by HowardTheDuck4Ever Thursday, November 16, 2017 4:21 PM
Thursday, November 16, 2017 4:20 PM
All replies
-
Hello,
Int data type is supported on Azure SQL Data Sync. For a list of supported and not supported data types please read page 88 on the following documentation:
Hope this helps.
Regards,Alberto Morillo
SQLCoffee.comWednesday, November 15, 2017 4:53 AM -
Thanks for the information, Alberto. I'm specifically wondering if GUID data types are required for primary keys in order to ensure uniqueness across tables in databases that are synced bidirectionally. If using type Int (with auto-increment) for the primary key and record(s) are created in a specific table on one server, when those record(s) are synced back to the hub how are they inserted to the hub table without causing a conflict? Or does Data Sync store its own index "under the hood" to manage data uniqueness and integrity across multiple databases?Wednesday, November 15, 2017 5:24 PM
-
Hello,
If you are using an int data type with identity to make the autoincrement then that identity will have to be a primary key also. That is a general requirement of SQL data Sync. For more information, please read below.
Hope this helps.
Regards,Alberto Morillo
SQLCoffee.com- Edited by Alberto MorilloMVP Thursday, November 16, 2017 4:54 AM
Thursday, November 16, 2017 4:54 AM -
Ok, so I believe that the answer to my question is "no". A GUID primary key is not required to ensure uniqueness when syncing data between table(s) using Azure Data Sync. Thanks for your help.
- Marked as answer by HowardTheDuck4Ever Thursday, November 16, 2017 4:21 PM
Thursday, November 16, 2017 4:20 PM -
- Edited by Alberto MorilloMVP Thursday, November 16, 2017 8:38 PM
Thursday, November 16, 2017 8:37 PM -
Hi @HowardTheDuck4Ever
I am fighting the exact same problem as you were. I have currently several on premises databases that I need to sync. They are setup to replication merge which has created GUID columns in the database but not as primary key. The only way I can get Azure sync to work is with Unique identifiers as primary key. If you could elaborate on how you made it work i would be forever grateful!
Best
Jeppe
Monday, February 5, 2018 2:58 PM