SQLITE syntax error code 1 when renaming a column name SQLITE syntax error code 1 when renaming a column name sqlite sqlite

SQLITE syntax error code 1 when renaming a column name


Rename keyword is available in SQLite version 3.25 which is not available for the latest android version. You will have to manually upgrade the table

1. Create item_tmp table with correct column value itemId

CREATE TABLE item_tmp(<column1> <data_type>, itemId <data_type>,.....)

2. Copy the data from item to item_tmp

INSERT INTO item(<column1>, <column2>,..)     SELECT <column1>, <column1>, ...     FROM item_tmp;

3. Drop table item

DROP TABLE item;

4. Rename the item_tmp table

ALTER TABLE item_tmp RENAME TO item;