none
So what if someone does a truncate on a table? RRS feed

  • Question

  • I am testing my sync framework code and when someone issues a truncate command, the sync framework things that those rows are still there and does not synchronize the changes.

     

    I am OK with truncate not being supported.... but my question is what can I do if someone does it in the environment.

     

    Is there I can detect that a truncate was performed and then re-provision the database? or is there a better solution that re-provisioning?

    Monday, March 21, 2011 6:45 AM

Answers

  • if you are able to check if the table has been truncated, you can update the tracking table directly similar to the way the delete trigger works.

    something like this:

    update mytable_tracking set sync_row_is_tombstone =1, local_update_peer_key=0, restore_timestamp= null, update_scope_local_id=null, last_change_datetime=getdate()

     

    • Marked as answer by MSDN Student Monday, March 21, 2011 5:15 PM
    Monday, March 21, 2011 7:48 AM
    Moderator

All replies

  • truncate dont fire triggers so the tracking table doesnt get updated.

    do you want to cascade the truncate to other sync partners?

    Monday, March 21, 2011 7:33 AM
    Moderator
  • yes. I have to keep the tables in sync right? so if the rows are deleted I must sync those changes as well.

     

    Monday, March 21, 2011 7:36 AM
  • if you are able to check if the table has been truncated, you can update the tracking table directly similar to the way the delete trigger works.

    something like this:

    update mytable_tracking set sync_row_is_tombstone =1, local_update_peer_key=0, restore_timestamp= null, update_scope_local_id=null, last_change_datetime=getdate()

     

    • Marked as answer by MSDN Student Monday, March 21, 2011 5:15 PM
    Monday, March 21, 2011 7:48 AM
    Moderator