gregmackers


Hi,

I'm merge replicating between SQL Server 2005 and SQL Compact on mobile devices. This has been running reasonably well, after a lot of setup problems, but recently I've noticed an error when a new subscription synchronizes with the server (creating a new database on the device). After running for several minutes, the synchronization stops with the following error:

"The row operation cannot be reapplied due to an integrity violation. Check the publication filter. [Table = AppUser,Operation = Insert,RowGuid = ..."

There are no filters on the publication. The record causing the problem already exists on the server and is apparently being added to the new database on the subscriber, but it seems the merge agent is trying to add the record twice. I've tried doing a new snapshot and then immediately synchronizing, but still the same error. Has anyone come across this problem when synchronizing, especially with a new database/subscription

Regards,

Greg




Re: Row operation cannot be reapplied

gtg529s


This error is created because of an integrity issue in you table schema. I had the same problem where I had created a foreign key relationship from one table to 2 fields in the joined table. For example:

My replication filtered on employee name (or HOST_NAME())

This employee table field existed in 2 fields of the joined table, ie: records could be sent to 2 subscriptions based on 2 fields in the record table which related to the employee table.

I had to delete the FK relationship in the database, and just kept the relationship in the filtered join in the replication. This solved the error.






Re: Row operation cannot be reapplied

fordiy

I encountered the problem too. Is the limitation of compact edition doesn't support FK relationship in the table

Anyone had worked around the issue

Jun






Re: Row operation cannot be reapplied

gtg529s

No, sql compact database supports fk relationships just fine. Replication, however, is very particular about the schema of the replicated tables. When setting up the replication be sure you know whether relationships are 1 to many, 1 to 1, or many to many. Any deviation from this will cause this or other errors. For example in my case I had 1 table FK relate to 2 fields in another table, although this schema can be fine in a normal production database, when replicated, it makes it hard for the replication to keep track of GUIDs and other replication objects. So I just deleted one of the relationships and kept the other.



Re: Row operation cannot be reapplied

DanielSmith

I am having a very similar issue - how did you get the error message to include the actual table, guid, etc. My error message is as follows:

The row operation cannot be reapplied due to an integrity violation. Check the Publication filter. [,,,Table,Operation,RowGuid] (Source: MSSQLServer, Error number: 28549)

I have a filter using HOST_NAME() as well with your typical FK's 1 field in one table to 1 field in another.

I am under the gun to get this app out and I just can not get enough details on this error to resolve, any help would be greatly appreciated.

Thanks,
Daniel





Re: Row operation cannot be reapplied

gtg529s

Since your error is not specifying a certain table, you'll have to test it 1 relationship at a time starting with the main filter relationship. Drop the relationship in the production database, re-create snapshot and reinitialize subscriptions until you've removed the errored relationship. Then re-examine your schema to determine why the error happened and see if you can re-design the relationship. Good luck.



Re: Row operation cannot be reapplied

DanielSmith

Wow, there is no way to turn on additional logging that would produce a more detailed error message