Identity的属性释疑
定义自增型int时,不明白“Yes (Not For Replication) ”和“Yes”在使用上有什么区别?使用场合有什么不同?特请教大家,多谢!
Identity
Shows whether the column is used by SQL Server as an identifier column. Possible values are:
No The column is not used as an identity column.
Yes The column is used as an identity column.
Yes (Not For Replication) The column is used as an identity column, except while a replication agent is inserting data into the table.
Identity Seed
Shows the seed value of an identity column. This option applies only to columns whose Identity option is set to Yes or Yes (Not For Replication).
Identity Increment
Shows the increment value of an identity column. This option applies only to columns whose Identity option is set to Yes or Yes (Not For Replication).
问题点数:15、回复次数:4Top
1 楼softj(天地客人<最近很迷茫>)回复于 2005-06-11 14:52:50 得分 5
是不是标识列,是不是不用于复制啊!Top
2 楼ghostzxp(幽灵)回复于 2005-06-11 15:12:20 得分 0
写的很明白阿。当复制代理向表中插入数据的时候,不作为标识列Top
3 楼nobody123(没有人)回复于 2005-06-11 15:39:12 得分 0
复制代理~不太清楚这个概念~
各位兄弟在使用Identity时是不是一般选择yes?Top
4 楼ghostzxp(幽灵)回复于 2005-06-11 15:47:14 得分 10
在复制中使用 IDENTITY 值
在为某列指派 IDENTITY 属性时,系统自动为表中插入的新行生成连续递增的编号。因为标识值通常唯一,所以标识列常定义为主键。
在发布中包含标识列和可在订阅服务器上插入新行的复制拓扑中,可能需要额外的配置以免出现重复标识值或违反约束。
为说明如何管理带有副本的标识值,假定来自发布服务器 A 的三行数据(含标识值 1、2 和 3)
被复制到订阅服务器 A 而且订阅服务器 A 允许插入。如果同一项目中插入两个新行,一行在发布服务器 A,一行在订阅服务器 A,并且复制代理程序未采取其它措施,则两行数据的标识值都赋为 4。复制代理程序会尝试在发布服务器和订阅服务器之间复制新行。如果成功,每个副本中都存在标识值为 4 的两个不同的行。结果,每个发布项目将包含多个具有相同标识值的行。如果标识列定义为主键或定义有唯一约束,则不会复制数据。
复制提供几个选项以保证相同的标识值不赋给插入不同副本中的行,或避免发生违反主键约束。
===================一般都是yes
Top




