How to fix Violation of PRIMARY KEY constraint with a composite PK?

Initial data: there is a server distribution, there is a server subscriber.
Configured transaction replication from distribution to subscriber.
Replication monitor provides the following:

Violation of PRIMARY KEY constraint 'PK_dboSM_AlarmsStatistics'. Cannot insert duplicate key in object 'dbo.SM_AlarmsStatistics'. The duplicate key value is (ExceedingCur, 6061, 0). (Source: MSSQLServer, Error number: 2627)


the table SM_AlarmsStatistics composite index of three columns which should contain (ExceedingCur, 6061, 0) from the error above.

if you run
use distribution
go
exec sp_browsereplcmds '0x000064A0000048E5000A00000000', '0x000064A0000048E5000A00000000'
--the error code in Replication monitor
go


we will see what stops replication(see how that works?)
Falls on point 2
1. {CALL [sp_MSins_dboSM_States] (677390,0,6061,2016-05-18 00:00:00.000,'ExceedingCur','Yes',1,1)}
2. {CALL [sp_MSins_dboSM_AlarmsStatistics] (N ExceedingCur',6061,0,2016-05-18 00:00:00.000,1,1,677390)}

I tried to make truncate this table, but the error remains, even though the table is empty.

Tried in this table to manually insert the values, all perfectly inserted in the subscriber
insert into SM_AlarmsStatistics values(N ExceedingCur',6061,0,convert(datetime, '2016-05-18 00:00:00.000',121),1,1,677390)


Can I upgrade as the composite index(something like DBCC CHECKIDENT (@fullTableName, RESEED, @nextIdToGo)) or what to do in this case?
July 9th 19 at 13:10
1 answer
July 9th 19 at 13:12
How to fix Violation of PRIMARY KEY constraint with a composite PK?
Configured replication with transaction...
Try to disable the replication of the column, table, base (alternately).
composite index
Use a surrogate key.
of the three columns
Make a unique key, for verification only.
Thanks for the answer came easily - turned off the respond to errors as described here:
https://www.mssqltips.com/sqlservertip/2469/handli... - jayda commented on July 9th 19 at 13:15

Find more questions by tags SQL ServerSQL