Synchronizing Data (SQL Server Compact Edition)

Data synchronization ensures that the data in the Microsoft SQL Server 2005 Compact Edition (SQL Server Compact Edition) subscription database matches the data in the corresponding publication. When you synchronize your SQL Server Compact Edition 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 Edition subscription.

How Data is Synchronized

When a SQL Server Compact Edition Subscriber synchronizes with SQL Server, all changes to the data are retrieved from the publication database. However, when a SQL Server Compact Edition 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 Edition, 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.

When Data is Synchronized

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.

Note

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.

See Also

Concepts

Synchronous Data Synchronization
Asynchronous Data Synchronization

Help and Information

Getting SQL Server Compact Edition Assistance