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

我的梦境 提交于 2019-12-25 04:43:04

问题


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 '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 properly at subscriber but not replicated at publisher

Any solution/suggesstion?


回答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.



来源:https://stackoverflow.com/questions/4236393/replication-explicit-value-must-be-specified-for-identity-column-in-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!