Id's jumping up 1000 every time I build my app and insert a new record

asp.net-core entity-framework entity-framework-core

Question

I'm building a basic CRUD page following beginner asp.net-core-mvc/ef-core tutorials

I've been noticing every time I rebuild and create a new record through my mvc site my Id's jump up 1000

Example, currently the id's for my first few rows are:

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

How do I stop this? I've never seen this behavior before. From some googling it seems to be a sql 2012 issue however I'm not using sql 2012.

I'm using mssqllocaldb, everything's updated and I have SSMS2014 installed

1
8
9/24/2016 2:57:12 AM

Accepted Answer

Even though you have installed the SSMS 2014, it doesn't install the 2014 local db instance. It still can be a SQL 2012 local DB. So my advice is to uninstall all old components and install the latest local db 2016 and SSMS 2016. Both are free.

Here are the links :

SQL Server 2016 Express LocalDB

SSMS 2016

Additional Note :

Yes this is a bug on the SQL server 2012.You can see it here :

Failover or Restart Results in Reseed of Identity

Workarounds :

If you need the Workarounds see the Workarounds tab on the above link.

enter image description here

Permanent solution :

If you need a permanent solution, you can use a higher version of SQL server. Like SQL server 2014 or 2016.You can select Free community editions of those.

5
3/5/2019 3:28:06 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow