-1

I have a database table Person with primary key ID, I set the identifier specification to "Yes" and the identity increment to 1 to make it auto-increment.

But all I am having are random numbers like 1, 33, 34, 1034, 1035, 2036, 3036, 4037

I want to make it Sequential like 1 2 3 etc...

RandomSeed
  • 29,301
  • 6
  • 52
  • 87
pawla
  • 1
  • 2

1 Answers1

0

An identity column guarantees sequential values but allows gaps. Gaps may occur due to row deletion, transaction rollbacks, server restart, or concurrency. If you don't want gaps, don't use IDENTITY. Consider using ROW_NUMBER() in your queries instead of you don't want gaps.

Dan Guzman
  • 43,250
  • 3
  • 46
  • 71