Problem In Primary Key

  • Dear Sir,

    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

    Thanking you

    Debasis

  • It shouldn't matter.

    But check out DBCC CHECKIDENT RESEED in BOL if you are adamant that it must be changed.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Identities aren't supposed to maintain a sequence without gaps. Why does it matter?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • 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 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply