Thread: Adding Column in Specific Position of table

Adding Column in Specific Position of table

From
Ankur Kaushik
Date:

Hi ,

I can I alter table to add column at specific position , 

below 

Table : Post


Column : a
              b
              d

Want to add new column c before d or after b.

Re: Adding Column in Specific Position of table

From
Jan Lentfer
Date:
Hi, this is not currently possibly with just an ALTER TABLE. Regards, Jan.

Von meinem iPad gesendet

> Am 29.04.2015 um 11:43 schrieb Ankur Kaushik <ankurkaushik@gmail.com>:
>
>
> Hi ,
>
> I can I alter table to add column at specific position ,
>
> below
>
> Table : Post
>
>
> Column : a
>               b
>               d
>
> Want to add new column c before d or after b.


Re: Adding Column in Specific Position of table

From
Jan Lentfer
Date:
None that I am aware of. But from my experience, order does not really matter.

Von meinem iPad gesendet

Am 29.04.2015 um 11:53 schrieb Ankur Kaushik <ankurkaushik@gmail.com>:


So Any Other way Apart from Recreating the table structure ?

On Wed, Apr 29, 2015 at 3:21 PM, Jan Lentfer <Jan.Lentfer@web.de> wrote:
Hi, this is not currently possibly with just an ALTER TABLE. Regards, Jan.

Von meinem iPad gesendet

> Am 29.04.2015 um 11:43 schrieb Ankur Kaushik <ankurkaushik@gmail.com>:
>
>
> Hi ,
>
> I can I alter table to add column at specific position ,
>
> below
>
> Table : Post
>
>
> Column : a
>               b
>               d
>
> Want to add new column c before d or after b.

Re: Adding Column in Specific Position of table

From
Craig James
Date:
On Wed, Apr 29, 2015 at 2:51 AM, Jan Lentfer <Jan.Lentfer@web.de> wrote:
Hi, this is not currently possibly with just an ALTER TABLE. Regards, Jan.

Von meinem iPad gesendet

> Am 29.04.2015 um 11:43 schrieb Ankur Kaushik <ankurkaushik@gmail.com>:
>
>
> Hi ,
>
> I can I alter table to add column at specific position ,
>
> below
>
> Table : Post
>
>
> Column : a
>               b
>               d
>
> Want to add new column c before d or after b.

It's probably a bad idea, too. If your application depends on the ordering of the columns, I guarantee you'll regret it. It's a recipe for mysterious bugs.

Every SQL query should name the columns. If you do that, the column ordering doesn't matter.

Craig