Violation of PRIMARY KEY constraint 'PK_TrxTransaction'. Cannot insert duplicate key in object 'dbo.

Violation of PRIMARY KEY constraint 'PK_TrxTransaction'. Cannot insert duplicate key in object 'dbo.

Product Version: 

iVend 6.5 Update 6 Replication


Problem Statement: 

One of their store replication monitor logs is not moving from both sides (Enterprise and store) and its culminating in the replication monitor.


Replication log file:

Error message : 8/19/2020 2:04:33 PM : Violation of PRIMARY KEY constraint 'PK_TrxTransaction'. Cannot insert duplicate key in object 'dbo.TrxTransaction'. The duplicate key value is (23000000000035978).


The statement has been terminated.


Proposed Solution:

Go to iVend Enterprise Machine--> Stop the Replication --> Rename the Replication log file--> Start the replication service --> Wait for 20 minutes so that it can capture the logs.
Go to iVend Store Machine--> Stop the Replication --> Rename the Replication log file--> Start the replication service --> Wait for 20 minutes so that it can capture the logs.


Check in HO Database RepReplicationStatus Where siteid=”storeID” must be equal to RepReplicationSendStatus at store database.


Check SysNextNumber where NextNumberID related to table%%’  and check the records in table Is serial


Is available or not is available discuss. If a greater number is already available in the table please check the next number availability. If not then it is good.


Steps Need To Perform:

Check the RepreplicationTransaction where sourcekey=’Sourcekeynumber’—Data available.

Stop Replication Services.


Delete the RepReplicationSendDump table data.


Truncate RepReplicationTransactionArchive table.


Start Replication Service.


It will start the Replication and the issue will resolve.