Bernhard Amann wrote: >> INSERT INTO <newtable> SELECT * FROM <oldtable>; >> >> However, this only works if <newtable> already exists, which is actually >> quite cumbersome.. >> Is there a way to make the new table 'on the fly"? > > create table newtable as select * from oldtable;
... however, this won't keep constraints, indexes, collation, comments, and will replace types with "generic" INT/TEXT/NUM/"": sqlite> CREATE TABLE t (a integer primary key /*foo*/, b text collate nocase unique, c datetime check (c<>''), d blob); sqlite> CREATE TABLE u AS SELECT * FROM t; sqlite> .schema CREATE TABLE t (a integer primary key /*foo*/, b text collate nocase unique, c datetime check (c<>''), d blob); CREATE TABLE u(a INT,b TEXT,c NUM,d); _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users