At 14:03 26/05/2004, Tito Ciuro wrote:
Hello,
I would like to add a new column to an existing table on-the-fly. I've
followed the code found on SQLite's website:
http://sqlite.org/faq.html#q13 and modified it slightly to the following:
Adding table 'address' to the database...
-----> CREATE TABLE address(ROWID INTEGER PRIMARY KEY,First
VARCHAR(255),Country VARCHAR(255),Last VARCHAR(255));
...
<add data to the 'address' table>
...
Adding one more column to 'address'...
-----> BEGIN TRANSACTION;
-----> CREATE TABLE address_backup(ROWID INTEGER PRIMARY KEY,First
VARCHAR(255),Country VARCHAR(255),Last VARCHAR(255),SSN VARCHAR(255));
-----> INSERT INTO address_backup SELECT ROWID,First,Last,Country FROM
address;
-----> COMMIT TRANSACTION;
The problem I've found is that SQLite reports the following error when
INSERT INTO is executed:
table address_backup has 5 columns but 4 values were supplied
I understand that the source table 'address' contains 4 columns and
destination table 'address_backup' has 5, so I would have to copy the
source data while ignoring the newly created column in the destination table?
Shouldn't the INSERT be
INSERT INTO address_backup (ROWID, First, Country, Last) SELET * from Address
Paul VPOP3 - Internet Email Server/Gateway
[EMAIL PROTECTED] http://www.pscs.co.uk/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]