6
Answers

Reset Primary Key Column

Abolfazl

Abolfazl

9y
766
1

hi

i have a table named users which have a ID column as primary key(is identity=true).

when i add some data to table everything is ok but when delete some of them,

the deleted IDs cause Irregularity in ID column.i want to reset the ID column to begin from 1 

and increment 1 per each data without remove existing data.

for example:

before delete : ID 1 2 3 4 5 6 7 8 9 

after delete : ID 1 2 4 5 8 9

what should i do???

thanks

Answers (6)