sqlite insert a new colum

2017-12-14  本文已影响0人  cz000

https://stackoverflow.com/questions/4253804/insert-new-column-into-table-in-sqlite

1

ALTER TABLE {tableName} ADD COLUMN COLNew {type};

2

ALTER TABLE {tableName} RENAME TO TempOldTable;
CREATE TABLE {tableName} (name TEXT, COLNew {type} DEFAULT {defaultValue}, qty INTEGER, rate REAL);
INSERT INTO {tableName} (name, qty, rate) SELECT name, qty, rate FROM TempOldTable;
DROP TABLE TempOldTable;
上一篇 下一篇

猜你喜欢

热点阅读