Replication – Explicit value must be specified for identity column in table

I am using Merge Replication. The Identity range management is AUTOMATIC

i HAVE A TRIGGER ON COMPANIES TABLE WHICH INSERTS ROWS IN SERIALNUMBERSCHEME TABLE which has documentID as identity column

While synchronizing i am getting below error

A row insert at ‘SERVERMUMBAI.PROD_SUB’ could not be propagated to ‘SERVERNEWYORK.PROD’. This failure can be caused by a constraint violation. Explicit value must be specified for identity column in table ‘SerialNumberScheme’ either when IDENTITY_INSERT is set to ON or when a replication user is inserting into a NOT FOR REPLICATION identity column.

Data is inserted properly at subscriber but not replicated at publisher

Any solution/suggesstion?

Enquirer: Thakur

||

Solution #1:

Sounds like your trigger gets fired when the replication agent applies the updates. Normally the trigger should run only at the publisher (or more precisely, at the site which inserts the original data). Then replication will replicate the effect of the trigger. I think that all you need is to mark the trigger as NOT FOR REPLICATION.

See Controlling Constraints, Identities, and Triggers with NOT FOR REPLICATION.

Respondent: Thakur

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.