Thanks! But it will take a long time if the table have a large number of rows.
I hope that SQLite will support "Alter Column" in next version!

----- Original Message ----- 
From: "Scott Hess" <[EMAIL PROTECTED]>
To: <sqlite-users@sqlite.org>
Sent: Monday, May 28, 2007 10:38 PM
Subject: Re: [sqlite] how to change SQLite column definition


> In case it wasn't obvious, the "more complicated way" would probably
> be something like:
> 
> BEGIN;
> ALTER TABLE RENAME MyTable TO MyTableOld;
> CREATE TABLE MyTable (
>  SameColumn INTEGER,
>  NewColumn TEXT
> );
> INSERT INTO MyTable SELECT SameColumn, OldColumn FROM MyTableOld;
> DROP TABLE MyTableOld;
> COMMIT;
> 
> As prose: Within a transaction, create the new table, populate it from
> the old table, and rename it into place.
> 
> -scott
> 
> 
> On 5/28/07, Dennis Povshedny <[EMAIL PROTECTED]> wrote:
>> AFAIK SQLite does not have such functionality.
>>
>> Please see http://sqlite.org/lang_altertable.html . So you have to do it
>> in a bit more complicated way.
>>
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: Monday, May 28, 2007 10:50 AM
>> To: sqlite-users@sqlite.org
>> Subject: [sqlite] how to change SQLite column definition
>>
>>
>> Is there any simple way to change the definition of a column in sqlite
>> database? we can do this in sqlserver using a sql statement like this:
>> alter table <tablename> alter column <column definition>....
> 
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> -----------------------------------------------------------------------------
> 
>

Reply via email to