In TSQL there is
SET IDENTITY_INSERT ON;
is there a functional equivalent in SQLite?
If the value inserted is larger than the current identity value for the table, SQL Server automatically uses the new inserted value as the current identity value. The setting of SET IDENTITY_INSERT is set at execute or run time and not at parse time.
The set identity_insert command in SQL Server, as the name implies, allows the user to insert explicit values into the identity column of a table.
In the first case, we will insert data into the table with the “IDENTITY INSERT” set to “OFF”. So, if the ID is present into the INSERT statement, you will get the error “Cannot insert explicit value for identity column in table 'person' when IDENTITY_INSERT is set to OFF”. Execute the following code in the query tab.
SQLite always allows inserting a value into the primary key column; automatically generated values are used only when the inserted value is NULL
(explicitly or omitted).
For details, see the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With