开发者

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

开发者 https://www.devze.com 2023-01-25 22:41 出处:网络
I\'m 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

I'm 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'm getting below error

A row insert at 'SERVER\MUMBAI.PROD_SUB' could not be propagated to 'SERVER\NEWYORK.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 p开发者_C百科roperly at subscriber but not replicated at publisher

Any solution/suggesstion?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号