Sqlite Drop Column: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 19: | Line 19: | ||
* [2] http://www.sqlite.org/faq.html#q13 | * [2] http://www.sqlite.org/faq.html#q13 | ||
* [3] http://sqlitebrowser.sourceforge.net/ | * [3] http://sqlitebrowser.sourceforge.net/ | ||
[[Category:FAQ]] |
Revision as of 20:01, 16 June 2006
Q: How can I drop a column in sqlite-databases?
A: It is not possible to drop columns within sqlite using the syntax ALTER TABLE DROP COLUMN [1]. However, there is a workaround for this issue [2]:
BEGIN TRANSACTION; CREATE TEMPORARY TABLE t1_backup(a,b); INSERT INTO t1_backup SELECT a,b FROM t1; DROP TABLE t1; CREATE TABLE t1(a,b); INSERT INTO t1 SELECT a,b FROM t1_backup; DROP TABLE t1_backup; COMMIT;
It's obvious that this is a little bit complex. But if you use sqlitebrowser [3] this can be done with a few mouse-clicks (look under -->modify table for a button "remove field".