How can I reset a autoincrement sequence number in sqlite

Building on Marcos Vasconcelos’ answer:

UPDATE sqlite_sequence SET seq = (SELECT MAX(col) FROM Tbl) WHERE name="Tbl"

This query will set seq to the largest value in the col identity column in the Tbl table, so there is no risk of violating constraints.

Leave a Comment