Filling the gaps in values of IDENTITY column

后端 未结 4 1740
南旧
南旧 2020-12-19 20:15

I have a table with an IDENTITY column

[Id] int IDENTITY(1, 1) NOT NULL

After some rows beeing added/removed I end with gaps in Id values:<

4条回答
  •  星月不相逢
    2020-12-19 20:46

    Well as far as I know the only way you can is manually update the values by turning Identity insert on..but you should really avoid doning such a thing in first place..also if you truncate the table it will not have those gaps.

提交回复
热议问题