FIX: "A specified value violated the integrity constraints for a column or table" error if the merge publication contains many articles and constraints in SQL Server Compact 3.5

Extended support for SQL Server 2005 ended on April 12, 2016

If you are still running SQL Server 2005, you will no longer receive security updates and technical support. We recommend upgrading to SQL Server 2014 and Azure SQL Database to achieve breakthrough performance, maintain security and compliance, and optimize your data platform infrastructure. Learn more about the options for upgrading from SQL Server 2005 to a supported version here.

SYMPTOMS
Consider the following scenario:
  • You install Microsoft SQL Server Compact 3.5 on a computer.
  • You create a subscriber in SQL Server Compact 3.5.
  • You download many rows from a merge publication to a database while the publisher synchronizes with the subscriber. The rows contain many articles and constraints.
In this scenario, an error message that resembles the following is logged in the SQL Server error log:
System.Data.SqlServerCe.SqlCeException
Native Error = 0, HRESULT = -2147217873, Error Message: A specified value violated the integrity constraints for a column or table.
Note This issue occurs in both 32-bit operating system and 64-bit operating system.
CAUSE
This issue occurs because an invalid exchange ID is used.

When many rows for download are in a pending state, SQL Compact Client Agent calls a retry method that uses an invalid exchange ID. Therefore, the issue that is mentioned in the "Symptoms" section occurs.
RESOLUTION
The hotfix that resolves this issue is included in cumulative update package 5 for SQL Server Compact 3.5 Service Pack 2 (SP2).

For more information about how to obtain cumulative update package 5 for SQL Server Compact 3.5 SP2, click the following article number to view the article in the Microsoft Knowledge Base:
2553608 Cumulative Update 5 for SQL Server Compact 3.5 Service Pack 2

Properties

Article ID: 2585082 - Last Review: 08/17/2011 09:13:00 - Revision: 2.0

Microsoft SQL Server Compact 3.5

  • kbqfe kbexpertiseadvanced kbfix kbsurveynew KB2585082
Feedback