Hmmm....could .dump also have the ability to put out the column names for the inserts?
That would solve this problem without having to write a special program to do it yourself. I suppose somebody might already have made a utility to do this? Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems ________________________________ From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Gerry Snyder [mesmerizer...@gmail.com] Sent: Monday, February 06, 2012 11:03 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] ALTER TABLE 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 _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users