Merge Replication: Inventory Conflict Resolution

  • Hi!

    Does anybody have any ideas, solution, advise for this problem:

    Say I have an "inventory" table having "quantity" column.

    quantity's initial value is 10

    At remote site 1 (publisher), orders are made, and quantity is reduced from 10 to 7.

    At remote site 2 (subscriber), stocks arrive, and quantity is increased from 10 to 30.

    Now when data is merged, quantity would result to 7, right?

    But that would be logically wrong, quantity is supposed to be

    (10 - 3 + 20) = 27

    So, how do you handle this conflict to get the correct quantity?

    I have some experience with Sybase and you can use the following to resolve the conflict:

    CREATE TRIGGER resolve_quantity

    RESOLVE UPDATE OF quantity

    ON "DBA".inventory

    REFERENCING OLD AS old_name

    NEW AS new_name

    REMOTE AS remote_name

    FOR EACH ROW

    BEGIN

    SET new_name.quantity = new_name.quantity + old_name.quantity - remote_name.quantity

    END

    in SQL server,

    OLD would be DELETED,

    NEW would be INSERTED,

    but what about REMOTE?

    Any help would be greatly appreciated

  • You can wrap that logic in a custom resolver! use an stored procedure ans mark the article resolver to use that sp.

    For more info look in BOL at

    Custom Stored Procedure Conflict Resolver

     

    hth


    * Noel

  • I was wondering if you came up with a solution to this.

  • Hi, I have the same problem as yours.  If you have the solution, please PM me.  Thanks

Viewing 4 posts - 1 through 3 (of 3 total)

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