views:

36

answers:

1

In my Production Server i have replication which working fine, i do have Distributed Database which as 2 subscriber db . My data is replicated from Production envi (working fine) but while data gets replicated to Distributed database in Subscriber it throws an Error

Err msg =
Replication-Replication Distribution Subsystem: PRD01-XYZ-VREPL1\REPL01-25 failed. Violation of PRIMARY KEY constraint 'PK_vendors'. Cannot insert duplicate key in object 'dbo.tabname'.

A: 

I haven't done this in a while, but here is a stab.

First, I wouldn't mind seeing the records which aren't matching, so I would try something like this:

--to be run on the publisher
select pub.*, sub.*
from 
    db_name1.dbo.tabname pub
    JOIN linked_server_to_subscriber.db_name1.dbo.tabname sub
        ON pub.pk = sub.pk
WHERE
    pub.some_field != sub.some_field

Hopefully, for "some_field", there is another unique column, or perhaps a dt_entered, or perhaps a rowguid. :).

Finally, if the logic of your situation involves records being inserted into the subscriber table other than by replication, and the type of replication is not merge, you may very well continue to have problems like this.

Good luck.

MaasSql