微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

sql-server – 将Identity_insert设置为 – 合并复制

我已经在两个数据库之间建立了合并复制,并且在这两个数据库之间使用了标识范围.

我想将一个特定的行添加到合并表(将身份值设置为身份范围之外)在发布者上.当我尝试这个,我得到以下错误.

The insert Failed. It conflicted with an identity range check
constraint in database ‘xxx’,replicated table ‘dbo.yyy’,column
‘yyy_id’. If the identity column is automatically managed by
replication,update the range as follows: for the Publisher,execute
sp_adjustpublisheridentityrange; for the Subscriber,run the
distribution Agent or the Merge Agent.

有没有办法强制使用身份范围管理的合并复制表中的特定身份值?

解决方法

一种方法是确保复制拓扑中的每个节点都使用不同的标识值范围,这样就不会发生重复.

For example,the Publisher Could be
assigned the range 1-100,Subscriber A
the range 101-200,and Subscriber B
the range 201-300. If a row is
inserted at the Publisher and the
identity value is,for example,65,
that value is replicated to each
Subscriber. When replication inserts
data at each Subscriber,it does not
increment the identity column value in
the Subscriber table; instead,the
literal value 65 is inserted. Only
user inserts,but not replication
agent inserts cause the identity
column value to be incremented.

参考. Replicating Identity Columns

原文地址:https://www.jb51.cc/mssql/81937.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐