身份和脱机以及联机插入的sql server复制 [英] sql server replication with identity inserted offline as well as online

查看:109
本文介绍了身份和脱机以及联机插入的sql server复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建帐单系统,因此可以在本地(离线)或通过远程位置(在线)创建Biil,并且想要

生成一个账单号,它表示完整的LIKE 1234,而不像NEWID()那样生成为随机数

因此,身份列可以离线生成,也可以在线生成,因此当数据通过复制合并时

如果在线和在线插入相同的ID,可能会导致问题.

就像是否从脱机以及在线插入9个值一样,这可能会引起问题.

I am creating billing system so biil can be made Locally(offline) or through a remote location (online) and want to

generate a bill number which is meaning full LIKE 1234 & not like NEWID() Which is generating as random number

so identity column to be generated offline as well as online so when data merge through a replication

it may cause a problem if same id is inserted ofline as well as online

Like if 9 value inserted from offline as well as online then it may cause a problem

推荐答案

为在线和离线帐单编号使用不同的前缀
Use different prefix for online & offline bill numbers


实际上是不可能的.
否则,您必须在同步本地数据库与在线数据库时更新凭证编号,这不是一个好方法
所以,
您应该为离线和在线条目使用诸如Branch ID/分支代码之类的前缀
祝您编码愉快!
:)
it is not practically possible.
else you have to update voucher nos while synchronize local database with online one, and it''s not a good way to do this
so,
you should use prefix like Branch id/ branch code for offline as well as online entries
Happy Coding!
:)


这篇关于身份和脱机以及联机插入的sql server复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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