0

I have mssql on my website and I don't know why but sometimes records skip numbers; for instance my numerical Primary ID is obviously a unique number that increases each time a new record is inserted 1..2..3..4 etc. but sometimes records increase by 1,000 instead of 1, is this a flaw or done on purpose by microsoft? like recently my records jumped from 67 to 1,068 .

For anyone who might have this problem... this issue is a bug in MSSQL 2012

http://social.msdn.microsoft.com/Forums/sqlserver/en-US/3d256650-0e94-4d0f-8b52-0ba6e1903215/primary-key-auto-incrementing-by-1000-instead-of-1

user1591668
  • 2,591
  • 5
  • 41
  • 84
  • It is not a bug, it is by design and the behavior can be reverted by using a trace flag. Please read the accepted answer in the linked question. – Mikael Eriksson Jun 12 '14 at 22:15

1 Answers1

0

MSSQL increases the identity by the amount you specified it to. You can read the details here but any number of things could have happened.

A DBA could have reseeded your column, or another developer could have inserted 1000 records, and then deleted them. The engine will not fill in identity columns.

I have never heard of the DBMS deciding on its own to skip 1000 though.

TheNorthWes
  • 2,661
  • 19
  • 35