### Alter Table

Altering a Table to for example remove a constrain is not possible in SQLite (Status 20160319).
To alter the table, a workaround is to create a temp table, import the data from the table to be altered, drop the table to be altered and rename the temp table to the table to be altered.
In this case a table downloads has a unique constrain for field Name which should be removed.
CREATE TABLE "downloads"
("ID" INTEGER PRIMARY KEY AUTOINCREMENT Not Null UNIQUE , "Name" VARCHAR UNIQUE Not Null, "Description" TEXT, "Link" TEXT, "Downloadgroup" TEXT)
Create the new table
CREATE TABLE "downloads2"
("ID" INTEGER PRIMARY KEY AUTOINCREMENT Not Null UNIQUE , "Name" VARCHAR Not Null, "Description" TEXT, "Link" TEXT, "Downloadgroup" TEXT)
Insert the data from the old table to the new table
INSERT INTO downloads2 SELECT * FROM downloads;
Drop the old table
DROP TABLE downloads;
Rename the new table to the its original name
ALTER TABLE downloads2 RENAME TO downloads;

Changed: , Category: SQLite, File: T6C254M1815.htm, ID: 1815