Predict next auto-inserted row id (SQLite)

Try SELECT * FROM SQLITE_SEQUENCE WHERE name="TABLE";. This will contain a field called seq which is the largest number for the selected table. Add 1 to this value to get the next ID.

Also see the SQLite Autoincrement article, which is where the above info came from.

Cheers!

Leave a Comment