Handling Conflicts in Merge Replication

  • Satia Madimchetty

    SSC Rookie

    Points: 39

    Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/sMadimchetty/handlingconflictsinmergereplication.asp

  • Ian Yates

    SSCoach

    Points: 19738

    Excellent article - very informative.  I like the detailed example about the common situations with stock systems and quantities on order, on shelf, etc...  Thank you very much

  • Clifton Collins

    Default port

    Points: 1433

    The article is very informative.  It encompasses some deviation to using replication beyond the "out of the box" solution.  However, has Microsoft or anyone else thought about replication and XML?  With SQL 2005 containing an XML data type, how will conflict resolution be handled if the XML data becomes a database inside the record?

    We currently have a situation where the XML columns have become the bulk of the data in several databases.  While replication works great along with conflict replication in a traditional database, only replication works great with XML in the mix.  Our situation could, at a minimum, be considered field abuse and be gravitating toward worst practices, as a maximum.  If it is accepted that at the minimum this is not a best practice, then could it be impractical to store XML in a database that requires replication?  Should the best practice be the storing of data in a normalized database and return XML as needed?

     

    [font="Arial"]Clifton G. Collins III[/font]

  • FroggEye

    SSC Veteran

    Points: 285

    I have found the article to be more informative than some of what MS has put out there regarding conflict resolution! 😀

    I do have a scenario where I know I need a custom resolver but just don't know how to impliment it. Here is my scenario if anyone is able to help or push me in the right direction please do...

    I have one table (TagMstr) with one PK (TagId), several FK's, a rowguid column, and several other columns. A record for TagMstr can already be in the SQL2005 database but not replicated to the end-users filtered set of data yet (because it does not have their UserId associated to it). What happens on the device is a new TagMstr record is written with the same PK as what is in the server database. When I come to do a sync I get a duplicate record error. Although it is doing what it should, I need to make it take the insert performed on the device and perform an update on the server.

    For instance in the tables below I need to update the server record with the yellow fields from the device record and remove the rowguid or rewrite the rowguid on the device. Is there already some type of conflict resolver which would do this or what type of resolver would I need?

  • jpdlp

    SSC Veteran

    Points: 251

    Nice article.

    And if the conflict was on the [Unit Stock] ?

    Example:

    In the article table, article X's article stock is 5

    subscriber 1 sold 1 unit and updated article stock to 4

    subscriber 2 sold 2 units and updated article stock to 3

    when they synchronize, there will be a conflict on article stock, and none of them is right. The right value should be 5-1-2 = 2

    How can i accomplish this?

    Thanks for your help!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply