I'm working on my Asp.Net MVC project. I'm using SQL Server Managment Studio. Why BrandId increase thousand by thousand?
Asked
Active
Viewed 506 times
0
-
2How does BrandId get a value as each row is inserted? – Randy Minder May 16 '16 at 17:49
-
Is this database in Azure? – jrummell May 16 '16 at 17:50
-
@jrummell Database isn't in Azure. – Sezer Türkdal May 16 '16 at 17:52
-
A really big transaction was rolled back? Showing us the table definition would help (Right click table > Script Table As > Create to > clipboard). – Bradley Uffner May 16 '16 at 17:53
-
Does the BrandId column have an identity specification? – Chris Dunaway May 16 '16 at 17:53
-
Insert a bunch more records and see what happens. If it is cyclical like that, its probably how the IDENTITY/TRIGGER was configured. If it run sequentially with no problems, something probably got deleted or rolled back. – dfundako May 16 '16 at 17:54
-
I've had this before when using migrations. Never got to the bottom of the issue, so I'll be interested to see if anyone has a solution / reason. – Erresen May 16 '16 at 17:55
-
@RandyMinder I set one by one to Identity Specification. Insert the row while ID increase automatically – Sezer Türkdal May 16 '16 at 17:58
-
do you using entity framework? – Nazmul Hasan May 16 '16 at 17:59
-
@ChrisDunaway I set one by one to Identity Specification. Insert the row while ID increase automatically. – Sezer Türkdal May 16 '16 at 18:00
-
@NazmulHasan Yes, I'm using Entity Framewok – Sezer Türkdal May 16 '16 at 18:01
-
do you deleted anything from first row? – Nazmul Hasan May 16 '16 at 18:02
1 Answers
1
Since BrandId
is an identity column, there are a few things that could cause what you're seeing.
Someone could have changed the seed increment to 1000.
Someone could have inserted large batches of rows and then rolled them back in a transaction. In this case, the increment doesn't get rolled back (I don't think).
Someone could have turned off (or overrode) the Identity property, manually inserted rows with those values and then turned Identity back on.
Given the values go from 1005 to 2002, it doesn't seem as likely the increment was changed to 1000. Option 2 or 3 seems more likely.

marc_s
- 732,580
- 175
- 1,330
- 1,459

Randy Minder
- 47,200
- 49
- 204
- 358
-
7none of the above, know bug(or feature) http://stackoverflow.com/questions/14146148/identity-increment-is-jumping-in-sql-server-database – Fredou May 16 '16 at 18:06