from https://sqlite.org/autoinc.html

On an INSERT, if the ROWID or INTEGER PRIMARY KEY column is not explicitly
given a value, then it will be filled automatically with an unused integer,
usually one more than the largest ROWID currently in use. This is true
regardless of whether or not the AUTOINCREMENT keyword is used.

conversely, if it IS specified then it will be used.

https://stackoverflow.com/questions/692856/set-start-value-for-autoincrement-in-sqlite

suggests that UPDATE SQLITE_SEQUENCE SET seq = <n> WHERE name = '<table>'
will work to initialize the value before any inserts are done.

On Tue, Jun 13, 2017 at 10:08 PM, Wout Mertens <wout.mert...@gmail.com>
wrote:

> Is there a way to specify the starting rowid when using autoincrement?
>
> Or should I insert and then remove a row with the id set to one less than
> the desired id?
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to