1

In the SQL Server database(2012), I have a product table. ProductID which is the primary key has auto increment by 1. This database is being accessed by several users and add new content. (this is a development server) Suddenly the primary key went up to 1000's from 60's. How can this happen? I am using Entity Framework to update/add data. We have not deleted anything yet. Here is how ID's being generated,

1..66 was fine. 66 67 68 69 70 71 1012 2012 3012 3013 3014 3015....3019 is fine

Dhanuka777
  • 8,331
  • 7
  • 70
  • 126
  • 4
    [Did you search first](http://stackoverflow.com/questions/20442543/sql-server-strange-identity-increment/)? And why do you care about gaps? IDENTITY doesn't guarantee "no gaps" anyway... – Aaron Bertrand Dec 19 '13 at 08:35
  • 1
    Identity should be just about uniqueness anyway, if you need to have gapless numbering for lets say bookkeeping then you need to work different logic. – Janne Matikainen Dec 19 '13 at 08:40
  • I also encountered that using Entity Framework even in SQL AZURE. It is a bug in the Entity Framework. – Jade Dec 19 '13 at 08:41

1 Answers1

-1

Try to order it by your Id and see what happens

SPandya
  • 1,161
  • 4
  • 26
  • 63