SQL Server 2008 R2

Data synchronization ensures that the data in the Microsoft SQL Server Compact 3.5 subscription database matches the data in the corresponding publication. When you synchronize your SQL Server Compact 3.5 database, any changes you make are sent to the publication. SQL Server merges your changes with any changes to the publication database, resolves any conflicts that occur, and then returns the changes to the SQL Server Compact 3.5 subscription.

When a SQL Server Compact 3.5 Subscriber synchronizes with SQL Server, all changes to the data are retrieved from the publication database. However, when a SQL Server Compact 3.5 subscriber is first synchronized, it can retrieve data from either the Publication database directly, or from the snapshot file (a .bcp file in the snapshot folder).

When synchronizing data with SQL Server Compact 3.5, you can perform either synchronous or asynchronous data synchronization. An application that uses synchronous data synchronization waits until synchronization is complete before continuing. However, if you write an application to use asynchronous data synchronization, your application can continue processing other information while waiting for the synchronization to complete. For more information, see Synchronous Data Synchronization and Asynchronous Data Synchronization.

Data is synchronized whenever your application requests synchronization by calling the Synchronize method of the Replication object. Synchronization can also occur automatically if there is a problem with a particular synchronization. An auto resynchronization message will be sent by the Publisher when one of the following scenarios occurs:

  1. There is a schema change on the Publisher.

  2. You are using a Subscriber-always-wins conflict resolver, and the data from the subscriber cannot be applied at the server

  3. There is a Referential Integrity (R/I) problem when the data from the Publisher is applied at the Subscriber.

  4. There is a column-level conflict on the Publisher. When this problem occurs, the server requests that the Subscriber resend the whole row.

  5. If Microsoft Internet Information Services is restarted during synchronization.

Auto resynchronization may occur up to five times consecutively. If there is an R/I problem that causes the auto resynchronization, only two auto resynchronizations will occur.