Answer the question
In order to leave comments, you need to log in
How to fix Violation of PRIMARY KEY constraint with composite PK?
Initial data: there is a distribution server, there is a subscriber server.
Transactional replication from distribution to subscriber is configured.
The replication monitor outputs 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)
use distribution
go
exec sp_browsereplcmds '0x000064A0000048E5000A00000000', '0x000064A0000048E5000A00000000'
--по коду ошибки в 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)
Answer the question
In order to leave comments, you need to log in
How to fix Violation of PRIMARY KEY constraint with composite PK?Try turning off column, table, database replication (one by one).
Transactional replication configured...
composite indexUse a surrogate key.
of three columnsMake a unique key, solely for verification.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question