locked
Backup unsynced data RRS feed

  • Question

  • I'm using SQL Server on the server and SQL Express on the clients.  I want to determine records which haven't been synced - I'm only dealing with inserted records as I don't do updates on the records in question.

    I've found the stored proc created by the sync [TableName]_selectchanges but arent sure how it works.

    Any ideas how I can find newly inserted records on the client which haven't yet been synced?

    TIA

    Tuesday, August 2, 2011 3:27 PM

Answers

  • save the date and time of your last sync on the client, then use the last_change_datetime of the tracking table to compare to the last sync datetime. any row in the tracking table whose last_change_datetime  greater than your last sync datetime are the changes youre after.

    • Marked as answer by Harjit Samra Wednesday, August 3, 2011 2:15 PM
    Wednesday, August 3, 2011 1:36 PM

All replies

  • in addition to the selectchanges, Sync framework inspects the sync knowledge as well to determine which rows has not been sync.

    the simpliest way to grab those changes is to simulate a sync, subscribe to ChangesSelected, once you get the change dataset, throw an exception to abort the sync.

    Wednesday, August 3, 2011 8:47 AM
  • Thanks for that JuneT.

    If I simulate a sync would it need access to the sync server to generate the 'change' dataset?

    Wednesday, August 3, 2011 10:40 AM
  • yes, it needs to compare the sync knowledge on the destination if it has the changes already.
    Wednesday, August 3, 2011 11:07 AM
  • Not the answer I was hoping for.  Sometimes our devices lose connection to the server - they are mobile devices and may not be in signal range.

    So I need to determine which records haven't been synced without a connection to the server.

    Wednesday, August 3, 2011 1:10 PM
  • save the date and time of your last sync on the client, then use the last_change_datetime of the tracking table to compare to the last sync datetime. any row in the tracking table whose last_change_datetime  greater than your last sync datetime are the changes youre after.

    • Marked as answer by Harjit Samra Wednesday, August 3, 2011 2:15 PM
    Wednesday, August 3, 2011 1:36 PM
  • Thanks for your help JuneT.
    Wednesday, August 3, 2011 2:16 PM