允许在合并复制中不跟踪单个列
使用合并复制,我有一个大部分都正常同步的表。但是,该表包含一列用于存储临时的客户端数据,该数据仅在客户端上进行有意义的编辑和使用,并且我不希望将其复制回服务器。例如:
CREATE TABLE MyTable (
ID UNIQUEIDENTIFIER NOT NULL PRIMARY KEY,
Name NVARCHAR(200),
ClientCode NVARCHAR(100)
)
在这种情况下,即使订阅者对表中的 ClientCode 列进行了更改,我也不希望这些更改返回到服务器。合并复制是否提供任何方法来实现此目的?
我可能会依赖的另一种方法是发布一个附加表,并将其配置为“仅下载给订阅者,允许订阅者更改”,然后引用该表中的 MyTable.ID 以及 ClientCode 。但如果我不是绝对需要的话,我宁愿不必发布额外的表格。
谢谢,
-丹
Using Merge Replication, I have a table that for the most part is synchronized normally. However, the table contains one column is used to store temporary, client-side data which is only meaningfully edited and used on the client, and which I don't have any desire to have replicated back to the server. For example:
CREATE TABLE MyTable (
ID UNIQUEIDENTIFIER NOT NULL PRIMARY KEY,
Name NVARCHAR(200),
ClientCode NVARCHAR(100)
)
In this case, even if subscribers make changes to the ClientCode column in the table, I don't want those changes getting back to the server. Does Merge Replication offer any means to accomplish this?
An alternate approach, which I may fall back on, would be to publish an additional table, and configure it to be "Download-only to subscriber, allow subscriber changes", and then reference MyTable.ID in that table, along with the ClientCode. But I'd rather not have to publish an additional table if I don't absolutely need to.
Thanks,
-Dan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,当您在出版物中创建文章时,不要包含此列。然后,创建一个脚本将该列添加回表中,并在发布属性中的快照下指定该脚本在应用快照后执行。
这意味着该列将同时存在于发布者和订阅者上,但将被复制完全忽略。当然,只有当要忽略的列可以为空时,您才能使用此技术。
Yes, when you create the article in the publication, don't include this column. Then, create a script that adds this column back to the table, and in the publication properties, under snapshot, specify that this script executes after the snapshot is applied.
This means that the column will exist on both the publisher and subscriber, but will be entirely ignored by replication. Of course, you can only use this technique if the column(s) to ignore are nullable.