locked
TruncateExistingOrCreateNewTable RRS feed

  • Question

  •  

    What that mean bros? I hoping it is just what it is with no ill affects.

     Thanks,

    BillB

    • Moved by Max Wang_1983 Friday, April 22, 2011 11:20 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, February 7, 2007 7:00 PM

Answers


  • SyncDirection is different than TableCreationOptions.

    If you want to keep the data in the local table intact, you have two options:

    1. UseExistingTableOrFail - this will keep your data and sync only new changes to it along with any new data
    2. UploadExistingOrCreateNewTable - this will mark your data to be uploaded in the next sync
    Wednesday, February 7, 2007 7:50 PM

All replies


  • If you are trying to sync table (T) and that table happen to exist in the client database and contains some data, then specifying CreationOption for T as TruncateExistingOrCreateNewTable instructs the sync runtime to delete the contents of T and reuse it (schema, indexes, constraints.. etc of T are kept intact). If T did not exist, then it will be created in the first sync based on the schema returned from the server.

    Thanks

    Wednesday, February 7, 2007 7:11 PM
  •  Rafik Robeal wrote:


    If you are trying to sync table (T) and that table happen to exist in the client database and contains some data, then specifying CreationOption for T as TruncateExistingOrCreateNewTable instructs the sync runtime to delete the contents of T and reuse it (schema, indexes, constraints.. etc of T are kept intact). If T did not exist, then it will be created in the first sync based on the schema returned from the server.

    Thanks

     

    So the data stays... right?

    Thanks man. :)

    Wednesday, February 7, 2007 7:19 PM

  • No, data will be truncated (i.e. deleted) the schema of the table will remain (i.e. column names, types, indexes .. etc)

    Wednesday, February 7, 2007 7:35 PM
  •  

    If i wanted to keep the data I'd use

    SyncDirection.Snapshot?

    or upload it then by using Bidirectional.... with no

    TableCreationOption.TruncateExistingOrCreateNewTable?

    Thanks again.. :)

    Wednesday, February 7, 2007 7:40 PM

  • SyncDirection is different than TableCreationOptions.

    If you want to keep the data in the local table intact, you have two options:

    1. UseExistingTableOrFail - this will keep your data and sync only new changes to it along with any new data
    2. UploadExistingOrCreateNewTable - this will mark your data to be uploaded in the next sync
    Wednesday, February 7, 2007 7:50 PM
  •  Rafik Robeal wrote:


    SyncDirection is different than TableCreationOptions.

    If you want to keep the data in the local table intact, you have two options:

    1. UseExistingTableOrFail - this will keep your data and sync only new changes to it along with any new data
    2. UploadExistingOrCreateNewTable - this will mark your data to be uploaded in the next sync

    very cool and thanks a ton! 

    USING THIS EXAMPLE:

    ' SYNC TABLES ProDetail _________________________________________________________________

    ' the SQL Server Everywhere Edition provider for the local Database __________________________

    Me.ClientSyncProvider = New SqlCeClientSyncProvider(My.Settings.MyConnectionString, True)

    'Each table to be syncronized needs a SyncTable definition to set the options

    Dim ProDetailSyncTable As New SyncTable

    With ProDetailSyncTable

    .TableName = "ProDetail"

    .SyncDirection = SyncDirection.Snapshot

    .CreationOption = TableCreationOption.UploadExistingOrCreateNewTable

    End With

    ' SYNC THE TABLE

    Me.SyncTables.Add(ProDetailSyncTable)

     

     

     

    Wednesday, February 7, 2007 8:06 PM