IDENTITY Columns with End-to-End SQL Provider Sample RRS feed

  • Question

  • Hello,

    The end-to-end SQL Provider sample, which synchronizes two SQL Server databases, does not work well with IDENTITY columns: if different records are added to both tables, sharing the same IDENTITY column value, one is overlapped by the other.

    Is there any way to go around this?


    Ricardo Peres
    Tuesday, February 23, 2010 3:43 PM


All replies

  • you may want to this out: http://msdn.microsoft.com/en-us/library/bb726011.aspx

    if you want automatic generation of a key, then you're next best bet will be uniqueidentifier (GUIDs).
    • Marked as answer by Yunwen Bai Wednesday, February 24, 2010 7:28 AM
    Tuesday, February 23, 2010 4:28 PM
  • JuneT is right. if you need to use ID columns, you will need to add logic in the application level to handle the range distribution of it.

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, February 24, 2010 7:27 AM
  • Hi,

    I am well aware of the problems with IDENTITY columns and how to use GUIDs to go over them, perhaps I should have been more clear.
    SQL Server Merge Replication goes around these issues by changing the tables and adding a UNIQUEIDENTIFIER column. I was wondering if anyone has implemented a Sync Framework provider that does something like this.
    For example, how can I modify the SQL scripts that Sync Framework uses to create the triggers and stored procedures it uses, is it possible to do so?


    Ricardo Peres
    Wednesday, February 24, 2010 10:41 AM
  • if you mean customizing the scripts generated by the sync scope provisioning api, i'm afraid you can't do much to customize the scripts to be generated for the SPs and triggers. You can however access the generated scripts from code via the SqlSyncTableProvisioning.Script method, customize it then, manually apply the provisioning scripts instead of calling the SqlSyncTableProvisioning.Apply method
    Wednesday, February 24, 2010 3:49 PM