BEGIN TRANSACTION; CREATE TEMPORARY TABLE attached_db.temp_table (...); INSERT INTO attached_db.temp_table SELECT * FROM attached_db.table1;
/* Add a comit */ COMMIT; DROP TABLE attached_db.table1; -- Error: Table is locked Yves Goergen <[EMAIL PROTECTED]> wrote: Hi, I want to modify the structure of a table, particularly remove a column. Since SQLite won't help me with that, I'll need to go the hard way by copying all data to a temp table, then re-creating the table with the new structure and copying all remaining data back. This works fine with a table from a regular database. But it fails when doing it with a table from an attached database. After backing up all data, when dropping the original table, I get an exception that says that the table which I want to drop is locked. Why that? Is there a difference when the table is from an attached database? Here's what I did: BEGIN TRANSACTION; CREATE TEMPORARY TABLE attached_db.temp_table (...); INSERT INTO attached_db.temp_table SELECT * FROM attached_db.table1; DROP TABLE attached_db.table1; -- Error: Table is locked Using SQLite 3.4.1 with the .NET wrapper in VS2005. -- Yves Goergen "LonelyPixel" Visit my web laboratory at http://beta.unclassified.de ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------