We delete some records in a sqlite3 table (re-id record manually) and compact the db. However when adding a new record in firefox sqlite3 manager, the auto incremented id is not the next available id but the id in previous table before compacting. This leaves a huge id gap between the old records and the new records entered. Is there a way we can make the new record taking next available id in firefox sqlie3 manager?
Asked
Active
Viewed 1,221 times
1
-
Here is an answer for resetting the primary key: http://stackoverflow.com/questions/3443630/reset-the-row-number-count-in-sqlite3-mysql – user938363 May 14 '14 at 21:35
2 Answers
1
next auto increment id will be the last highest id regardless if it exists or not. You'll have to reset the auto increment id

ivcode
- 1,062
- 1
- 9
- 13
0
Here is an easy way to reset the primary key:
Open the table sqlite_sequence in the sqlite3 database. Locate the table you want to reset the primary key and reset column seq to the next available id.

user938363
- 97
- 2
- 11