本文介绍了为什么SQL Server跳过标识列值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我对SQL Server的标识"列属性有一个奇怪的经历.
我有一个带有标识列的表.今天早上,我注意到SQL Server跳过了该列中的值.
现在的值就像
101
102
103
105

我在这里没有看到104.

我通过在插入数据时创建异常来重新生成此问题.每当发生异常时,SQL都会将其视为插入,并在下一次插入尝试时跳过该值.

我该如何解决?我希望此标识列值是连续的.

谢谢您的时间
Sebastian

Hi,

I had a strange experience with SQL Server''s Identity column property.
I have a table with an identity column. This morning I noticed that SQL server skipped a value in that column.
Now the values are like
101
102
103
105

I am not seeing 104 here.

I have regenerated this issue by creating an exception while inserting data. whenever an exception occurs, SQL considers that as an insertion and skips that value in the next insertion attempt.

How I can solve this? I want this identity column value be sequential.

Thanks for your time
Sebastian

推荐答案



这篇关于为什么SQL Server跳过标识列值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 08:37