On 2/6/2012 9:22 AM, Bill McCormick wrote:
Sorry, I should have mentioned that I did see that, but it doesn't
quite fit my application. I need a script that doesn't care what the
existing table looks like. In my situation, I may have dozens of
databases among different locations, perhaps not all at the same
revision level. The script I need would be able to bring each up to
the current revision.
So, if I had a fist step:
CREATE TEMPORARY TABLE t1_backup AS SELECT * FROM t1;
and then
DROP TABLE t1;
and then add the table with it's latest schema revision
CREATE TABLE t1( ... );
It seems difficult to get the saved data back in ...
INSERT INTO t1 SELECT * FROM t1_backup;
... without know what the previous schema looks like. It complains
like this:
Error: table prod has 27 columns but 25 values were supplied
Yes, the INSERT statement has to specify all of the original column
names in the proper order.
I wrote a general ALTER TABLE code in Tcl, and it is one of the largest
functions in the system. It includes moving columns within a table,
since I agree some times a simple spreadsheet-like display is useful.
Gerry
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users