Thread: Alter Table

Alter Table

From
"Shavonne Marietta Wijesinghe"
Date:
When i alter a table and add a new column it always adds it to the end of the table. Is there any way to tell it to add the new column at the 5th position or to add the new column after a surtain column.
 
Thanks
 
Shavonne Wijesinghe
http://www.studioform.it
 
 

Re: Alter Table

From
"A. Kretschmer"
Date:
am  Thu, dem 15.03.2007, um 14:35:41 +0100 mailte Shavonne Marietta Wijesinghe folgendes:
> When i alter a table and add a new column it always adds it to the end of the
> table. Is there any way to tell it to add the new column at the 5th position or
> to add the new column after a surtain column.

No, but you can (and should) define the column-order in the select-statement.

Other solutions:
- define a VIEW
- recreate the table


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net


Re: Alter Table

From
Scott Marlowe
Date:
On Thu, 2007-03-15 at 08:35, Shavonne Marietta Wijesinghe wrote:
> When i alter a table and add a new column it always adds it to the end
> of the table. Is there any way to tell it to add the new column at the
> 5th position or to add the new column after a surtain column.

No, but the good news is you can just recreate the table once it's
stabilized in form with something like:

create table new_table as select field1, field4, field2, field3 from
old_table;