为什么我的 IDENTITY 列值存在差距? [英] Why are there gaps in my IDENTITY column values?

查看:39
本文介绍了为什么我的 IDENTITY 列值存在差距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题.

我的主 ID (IDENTITY) 配置为自动递增(类型:int).但是,当我插入新行时,这个新 id 不是连续的.怎么了?有什么解决办法吗?

My ID Primary (IDENTITY) is configure to auto-increment (type: int). But, when I insert a new row, this new id is not consecutive. What is happening? Any solutions?

[...]
[id]int] IDENTITY(1,1) NOT NULL,
[...]
CONTRAINT [PK_Medida] PRIMARY KEY CLUSTERED
(
[id] ASC
) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

推荐答案

不要期望标识是连续的.有许多场景可能会留下空白.将身份视为一个抽象的数字,不要为其附加任何商业意义.

Do not expect the identities to be consecutive. There are many scenarios that can leave gaps. Consider the identity like an abstract number and do not attach any business meaning to it.

这篇关于为什么我的 IDENTITY 列值存在差距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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