[SQLite] set a value in an autoincrement field ?

Hi all,

I have a quite big database, all tables have an integer primarykey with autoincrement

I want to import some datas, and on some tables if I set a value to the primary key, it is stored in the database correctly
and some other tables, sqlite really make an autoincrement and it does not store the value I want to import in it

are there some rules ? I cannot see differences between when it works or not…
it is always in the same tables, so I think there must be a parameter for that ?


If you include the primary key value in your INSERT INTO tableName (…) VALUES (…, …, …) statement then it will not use the AUTOINCREMENT value. If you don’t include the primary key value in your INSERT statement then it will use the AUTOINCREMENT value as the primary key.

If you try to INSERT and a primary key already exists, it will return an error and not insert the record.