Last post Feb 16, 2015 04:54 AM by terminator1112
Feb 16, 2015 02:42 AM|terminator1112|LINK
I have developed a web app in MVC ASP.net.
I am facing problem with the table Id. Sometimes all of sudden. It skips approx 1000 numbers whenever user creates new entry.
Like for e.g
I want the Id to be in correct order. Is there any way to solve this problem?
Feb 16, 2015 02:58 AM|Mikesdotnetting|LINK
It's a "feature" in SQL Server 2012: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/3d256650-0e94-4d0f-8b52-0ba6e1903215/primary-key-auto-incrementing-by-1000-instead-of-1?forum=transactsql
You should never rely on IDENTITY values being sequential in any event. That has never been guaranteed.
Feb 16, 2015 03:05 AM|eralper|LINK
gaps in identity numbers are mainly caused by rolled-backed transactions or by the applications themselves.
For example, you inserted a new row in a transaction but not yet committed. Then an error or a rule in your sql code caused a rollback, then the identity used is skipped.
If an identity is read, the next number will be offered for the new coming request.
Feb 16, 2015 04:54 AM|terminator1112|LINK
Thanks for the reply.
I used t272 option in SQL server configuration manager and problem is gone away.