SQLite - Autoincrement Primary Key (started from a specific value)

<>

This question already has an answer here:

Answers


You can take a look at the sqlite documentation.

SQLite keeps track of the largest ROWID that a table has ever held using an internal table named "sqlite_sequence". The sqlite_sequence table is created and initialized automatically whenever a normal table that contains an AUTOINCREMENT column is created. The content of the sqlite_sequence table can be modified using ordinary UPDATE, INSERT, and DELETE statements. But making modifications to this table will likely perturb the AUTOINCREMENT key generation algorithm. Make sure you know what you are doing before you undertake such changes.

You can update the sqlite_sequence table to your table autoincrement starts at 100 for example.


When inserting first record, add the start value for the auto increment field. then all new records will start from that value.


Need Your Help

List SQL calendar days with events

sql sql-server

I have a table of bookings within my SQL server database, which simply comprises

Quicker Forms html/php?

php html forms class

I'm working on a project at the moment that requires alot of forms. I was thinking of a workaround to minimise spending hours of time on the subject. Above all else I don't want to use a framewor...