0

I have a table TabInvoice with an auto-increment (1+1) column InvoiceID.

But there is something is wrong with (as shown in the picture).

When user enters data into TabInvoice (via vb.net form) till 4 records it is good but after that the column automatically changed to 1001 rather to 5 and after 1007 it changed to 2001 and so on.

Kindly guide .

enter image description here

I searched a lot but in vain

Dale K
  • 25,246
  • 15
  • 42
  • 71
  • 8
    It's a known and well documented issue, starting with SQL Server 2012, and MS claims it was fixed in SQL Server 2019. It has to do with SQL Server caching identity values. You can influence that in various ways - but really, even those jumps shouldn't be a problem ... – marc_s Aug 10 '23 at 04:58
  • 9
    You shouldn't really about the id values, they should be a primary key only. If you need a human facing key you should generate that separately. – Dale K Aug 10 '23 at 05:09
  • 1
    [SQL Server’s identity column misconceptions - An Identity column generates consecutive numbers](https://zoharpeled.wordpress.com/2019/10/06/sql-servers-identity-column-misconceptions/#An-Identity-column-generates-consecutive-numbers) – Zohar Peled Aug 10 '23 at 07:03

0 Answers0