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)
use distribution
go
exec sp_browsereplcmds '0x000064A0000048E5000A00000000', '0x000064A0000048E5000A00000000'
--the error code in Replication monitor
go
insert into SM_AlarmsStatistics values(N ExceedingCur',6061,0,convert(datetime, '2016-05-18 00:00:00.000',121),1,1,677390)
How to fix Violation of PRIMARY KEY constraint with a composite PK?Try to disable the replication of the column, table, base (alternately).
Configured replication with transaction...
composite indexUse a surrogate key.
of the three columnsMake a unique key, for verification only.
Find more questions by tags SQL ServerSQL
https://www.mssqltips.com/sqlservertip/2469/handli... - jayda commented on July 9th 19 at 13:15