none
can't track the change when primary key updated RRS feed

  • Question

  • Not sure this is the well known issue here or not, at least I didn't see any releated topics pop up when I trying to post the question.

    I found when I try update some records' primary key, there's no relative tracking records in sync tracking tables, so the sync framework never know these records are changed and lost the chance to sync to other Peers,  do you guys have any idea?    this also cause some other potential problems, like Null value insert and etc.


    This is shawn.

    Saturday, July 21, 2012 2:07 AM

Answers

  • it's a known behaviour. Sync Framework doesnt support synching changes for rows whose PK value has been changed.

    for additional context, sync fx tracks changes via triggers. the triggers stores the PK of the changed row in the tracking table. in the case of an update and delete, it uses this PK to find the matching row in the sync destination.

    if you look at the update trigger, you will find its not updating the PK column in the tracking table.

    even if the PK value in the tracking table is updated, it will never find the matching row in the destination since it still has the old PK value.

    the commont workaround is to do a delete and insert: delete the old row with the old PK and reinsert with the new PK. this sends both delete and insert in the next sync. 

    but this becomes more complicated if you have child tables. 

    • Marked as answer by Shawn.shao Wednesday, July 25, 2012 5:45 AM
    Monday, July 23, 2012 2:15 AM
    Moderator