Gossamer Forum
Home : Products : Others : MySQLMan :

possible to move a column?

Quote Reply
possible to move a column?
Hi there.

Is there any way with MySQLMan to move a column (preferably with all its data) from one position to another in a table? I know this is possible with PHPMyAdmin, but I can't seem to figure out any easy way to do it with MySQLMan. If this is not, in fact, possible, is there an SQL query that could accomplish this?

Thanks for your help.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [hennagaijin] possible to move a column? In reply to
Nope, no way with MySQLMan.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [hennagaijin] possible to move a column? In reply to
Hello Hennagaijin,

Sql to move a column D to between C and E in table named toy , assuming an "int" type

A B C E D

ALTER TABLE toy ADD tmp int AFTER c

UPDATE toy SET tmp=d
ALTER TABLE toy DROP d
ALTER TABLE toy CHANGE tmp d int


Should give you

A B C D E

Backup before !

You may have to drop and recreate any indexes on this moved column.

Hope this helps

kode



Quote Reply
Re: [kode] possible to move a column? In reply to
That worked perfectly! Thanks.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund