[Zope-DB] How to add a field after another field SQL SERVER
Harry Wilkinson
harryw@nipltd.com
Mon, 15 Apr 2002 11:34:47 +0100
On Saturday 13 April 2002 1:10 am, Mauricio Vélez wrote:
> Hello Everybody
>
> I'm using sql server and I want to write a script with
> the command ALTER TABLE to add a field.
> By default it is added at the end, but I want to add
> it after another field
>
> How can I do this?
>
> Regards
> Mauricio
>
This is pretty simple in MySQL. I don't know if it's standard SQL syntax but
in MySQL you do this with the FIRST or AFTER <colname> keywords. So, if you
want to add the column 'extracolumn' so it's just after the 'col3' column you
would write:
ALTER TABLE tablename ADD COLUMN extracolumn varchar(255) default '' AFTER
col3;
HTH.
Harry