locked
Reinitialize single table RRS feed

  • Question

  • Here's the scenario :

    Using Sync Framework a mobile device using SQL CE synchronizes with SQL Server 2008.

    Some tables are download only and others are bidirectional.

    The ones that are bidirectional have filters and after 1 week the rows become obsolete.

    I need to find a way to reinitialize only the tables that are bidirectional.

    I tried changing to SyncDirection.Snapshot and then to SyncDirection.Bidirectional but this causes the tables to get all data twice.

    Is there a way to overcome this ?

    Thanks for your help.

    Tuesday, February 15, 2011 2:17 PM

Answers

  • Note that the table will get refreshed with truncate and create new table options during the first sync.

    The other options would be to separate out these set of tables that need refreshing into a separate database and when time to refresh, drop it, re-create it and let sync bring in new data into the tables.


    This posting is provided AS IS with no warranties, and confers no rights
    Wednesday, February 16, 2011 8:04 AM

All replies

  • when you want to reinitialize a specific table, you can try setting the TableCreationOption for that table alone to TruncateExistingOrCreateNewTable or DropExistingOrCreateNewTable.

    Wednesday, February 16, 2011 1:46 AM
  • Note that the table will get refreshed with truncate and create new table options during the first sync.

    The other options would be to separate out these set of tables that need refreshing into a separate database and when time to refresh, drop it, re-create it and let sync bring in new data into the tables.


    This posting is provided AS IS with no warranties, and confers no rights
    Wednesday, February 16, 2011 8:04 AM
  • when you want to reinitialize a specific table, you can try setting the TableCreationOption for that table alone to TruncateExistingOrCreateNewTable or DropExistingOrCreateNewTable.

    June, those options will only affect in the first synchronization right ?

    That's not the case here.

     

    Wednesday, February 16, 2011 10:08 PM
  • Note that the table will get refreshed with truncate and create new table options during the first sync.

    The other options would be to separate out these set of tables that need refreshing into a separate database and when time to refresh, drop it, re-create it and let sync bring in new data into the tables.


    This posting is provided AS IS with no warranties, and confers no rights


    That could be an option indeed.

    Is it possible to delete the tables programatically?

     

    Wednesday, February 16, 2011 10:10 PM
  • Note that the table will get refreshed with truncate and create new table options during the first sync.

    The other options would be to separate out these set of tables that need refreshing into a separate database and when time to refresh, drop it, re-create it and let sync bring in new data into the tables.


    This posting is provided AS IS with no warranties, and confers no rights


    That could be an option indeed.

    Is it possible to delete the tables programatically?

     

      the option is set everytime you add a table to the sync group. so this setting can be modified everytime you sync.

    you'll find something similar to this in your code:

    SyncTable orderHeaderSyncTable = new SyncTable("OrderHeader");
    orderHeaderSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable;
    orderHeaderSyncTable.SyncDirection = SyncDirection.DownloadOnly;
    orderHeaderSyncTable.SyncGroup = orderSyncGroup;
    this.Configuration.SyncTables.Add(orderHeaderSyncTable);        

    Wednesday, February 16, 2011 11:05 PM