Id jumps to 1000 every time I create my application and insert a new record

I am creating a CRUD base page by following asp.net-core-mvc / ef-core beginner's instructions.

I notice every time I rebuild and create a new entry through my mvc site, my Id jump up 1000

For example, there is currently an identifier for my first few lines:

  • 1, 2, 1002, 1003, 1004, 2002, 2003, 3002, 3003, 4002, 5002

How to stop this? I've never seen this before. Of some googling, this seems to be a sql 2012 problem, but I am not using sql 2012.

I use mssqllocaldb, everything is updated and I have SSMS2014 installed

+5
source share
1 answer

Even if you installed SSMS 2014 , it does not install the 2014 local db instance. It could still be SQL 2012 local DB . So I advise you to remove all old components and install the latest local db 2016 and SSMS 2016 . Letters are free .

Here are the links:

SQL Server 2016 Express LocalDB

SSMS 2016

Additional Note:

Yes, this is a bug in SQL server 2012 . You can see it here:

Failover or restarting results in Reseed Identity

Workarounds:

if you need workarounds, see the Workarounds tab in the link above.

enter image description here

Permanent decision:

If you need a permanent solution, you can use a higher version of SQL Server. Like SQL server 2014 or 2016 . You can choose Free community editions from them.

+3
source

All Articles