mercredi 14 octobre 2015

SQLite: *prevent* PRIMARY KEY value from resetting after delete all rows

I have a SQLite table, with a few columns, including an "ID" column which is INTEGER PRIMARY KEY. When I insert, this value increments as expected.

However, when I delete all rows, this column's value reverts to 1 on the next insert.

Is there a way to have the column value continue to increment from the highest value before deletion?

For example:
(empty table)
insert
insert
(ID value of 2nd row is 2, next insert would be 3)
delete all rows
insert
(ID value for this latest row is 1, but I want it to be 3)

Aucun commentaire:

Enregistrer un commentaire