Can I alter a column in an sqlite table to AUTOINCREMENT after creation?

You can dump the content to a new table:

CREATE TABLE failed_banks_id (id integer primary key autoincrement, name text, city text, state text, zip integer, acquired_by text, close_date date, updated_date date);

INSERT INTO failed_banks_id(name, city, state, zip, acquired_by,close_date, updated_date)
SELECT name, city, state, zip, acquired_by,close_date, updated_date
FROM failed_banks;

And rename the table:

DROP TABLE failed_banks;
ALTER TABLE failed_banks_id RENAME TO failed_banks;

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)