June 15, 2012 at 6:57 am
I am in great trouble that I have a primary key field which is data type is int and identity specified. but problem is i can't maintain sequence due to
when I delete one record then i can't recover previous no. how to get back the previous serial no. please tell me
June 15, 2012 at 7:07 am
It shouldn't matter.
But check out DBCC CHECKIDENT RESEED in BOL if you are adamant that it must be changed.
If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.
See https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help/ for details of how to post T-SQL code-related questions.
June 15, 2012 at 7:17 am
Identities aren't supposed to maintain a sequence without gaps. Why does it matter?
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Michael Valentine Jones
June 15, 2012 at 7:19 am
IDENTITY is not meant to maintain an unbroken sequence. It is only meant to quickly produce a new unique value that is higher than the last one that was used.
If you delete a row or if an insert fails, the IDENTITY value is not reused.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply