Change column / field order in OpenOffice Base ( HSQL )

Altering the sequence of fields of a table was a feature I was looking for in OpenOffice Base. It is not directly possible to drag the columns or fields and alter their sequence.

A SQL workaround can do the same thing.

If the sequence of fields is :

name , email , address , phone

and phone is to be brought before address like this :

name , email , phone , address

then the sql for this should be

1. ALTER TABLE "tablename" ADD COLUMN "phone2" INTEGER BEFORE "address"

2. UPDATE "tablename" SET "phone2" = "phone"

3. ALTER TABLE "tablename" DROP COLUMN "phone"

4. ALTER TABLE "tablename" ALTER COLUMN "phone2" RENAME TO "phone"

Then View > Refresh Tables in the top menu. And open the table again for viewing.
The sequence should now be name , email , phone , address






Last Updated On : 23rd January 2009

Subscribe to get updates delivered to your inbox

About Silver Moon

Php developer, blogger and Linux enthusiast. He can be reached at [email protected]. Or find him on

Leave a comment