SQLite Forum

Modify rowid via C-API callback
You should not do this because unless you have explicitly aliased the rowid otherwise the value is ephemeral and subject to change at whim.  There are actually specific conditions on which the rowid will change, but this is immaterial.  To an uneducated consumer it will appear that the rowid has magically changed for no apparent reason and one should never suggest a solution which will result in generating a complaint a dozen messages on that you could have avoided by simply giving a more correct answer.

Define a column alias for the rowid and set it in the insert statement.


But to answer the question asked, No.  If you want a specific value you must set it during the insert.  You may have an AFTER INSERT trigger which updates it after insert however that is the only control you have.  And the value is only stable if the rowid is aliased, otherwise it is subject to change on a whim.