复制 - 必须为表中的标识列指定显式值

发布于 2024-10-03 09:29:25 字数 328 浏览 1 评论 0原文

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

我在公司表上有一个触发器,该表在 SERIALNUMBERSCHEME 表中插入行,该表将 documentID 作为身份列

在同步时出现以下错误:

在“SERVER\MUMBAI.PROD_SUB”插入的行无法传播到“服务器\纽约.产品'。此失败可能是由于违反约束导致的。当 IDENTITY_INSERT 设置为 ON 或复制用户插入 NOT FOR REPLICATION 标识列时,必须为表“SerialNumberScheme”中的标识列指定显式值。

数据在订阅者处正确插入,但在发布者处未复制

有任何解决方案/建议吗?

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

Any solution/suggesstion?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦回梦里 2024-10-10 09:29:25

听起来当复制代理应用更新时您的触发器被触发。通常,触发器应仅在发布者处运行(或更准确地说,在插入原始数据的站点处)。然后复制将复制触发器的效果。我认为您所需要做的就是将触发器标记为“NOT FOR REPLICATION”。

请参阅通过 NOT FOR REPLICATION 控制约束、标识和触发器

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文