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?
> 

Probably another thread or process is reading from the database
and does not want you to drop the table out from under it.


> 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" <[EMAIL PROTECTED]>
> Visit my web laboratory at http://beta.unclassified.de
> 
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> -----------------------------------------------------------------------------
> 
> 
> .



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to