复制-必须为表中的标识列指定显式值 [英] Replication - Explicit value must be specified for identity column in table

查看:685
本文介绍了复制-必须为表中的标识列指定显式值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用合并复制。身份范围管理是自动的

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

i在具有插入ID的SERIALNUMBERSCHEME表中行的公司表上触发了

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

SERVER\MUMBAI.PROD_SUB处的行插入无法传播到 SERVER'NEWYORK。 PROD。此失败可能是由于违反约束引起的。当IDENTITY_INSERT设置为ON或将复制用户插入到NOT FOR REPLICATION身份列中时,必须为表'SerialNumberScheme'中的身份列指定显式值。

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

任何解决方案/建议?

推荐答案

当复制代理应用更新时,触发触发器之类的声音。通常,触发器应仅在发布者(或更确切地说,在插入原始数据的站点)上运行。然后复制将复制触发器的效果。我认为您只需要将触发器标记为不可以复制

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.

请参见使用NOT FOR REPLICATION来控制约束,标识和触发器

这篇关于复制-必须为表中的标识列指定显式值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆