MS Sync framework - Identity crisis resolution by partitioning the primary key.

Posted by user326136 on Stack Overflow See other posts from Stack Overflow or by user326136
Published on 2010-05-09T08:22:56Z Indexed on 2010/05/09 8:28 UTC
Read the original article Hit count: 179

Hello,

We implementing offline feature to an existing application. We have implemented the syn with SQL Server internal change tracking and over WCF using MS Sync Framework (http://msdn.microsoft.com/en-us/sync/default.aspx)

All of our tables have primary key as integer, we cannot move to GUID. So as you are thinking we will have identity crises between applications. So we decided to go with the way Merge replication does(http://msdn.microsoft.com/en-us/library/aa179416(SQL.80).aspx) partition the primary key range. Below is the example scenario -

Server

Table A - ID Range - 0 to 100

Client 1

Table A - ID Range - 101 to 200

Client 2

Table A - ID Range - 201 to 300

how to implement this ? i know we can use

BCC CHECKIDENT (yourtable, reseed, value)

CHECK (([ID]<=(100)))

but this does not solve the issue.... Merge replication provides an option of "Not for replication"(http://msdn.microsoft.com/en-us/library/aa237102(SQL.80).aspx) to achieve insert form clients and still maintain the set range.. can i use that somehow here?

please help...

© Stack Overflow or respective owner

Related posts about c#

Related posts about mssql-2008