AutoIncrement number

  • Hi !

    Would like to know the following,

    If a table holds a column of Identity property 'Yes', its automatically fixed to get new values for new records.

    But if in case any of the previous row is getting deleted the value for the autoincrement column is also getting lost. when a new records is added the deleted last number is not getting assigned.

    Its fine in case if its not assigning the value of the column, when a row is in mid of many rows, but atleast if the last row is getting deleted, shouldn't it get the value be hold on for the new records ???

    Why so being in SQL ?

    is there a reason behind?

  • Simple reason - efficiency. Same reason that, should an insert fail, those identity values are not reused.

    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

Viewing 2 posts - 1 through 1 (of 1 total)

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