Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version


Changing the order of fields in a database is not a function of Base but rather that of the database. This is difficult to accomplish in the HSQLDB embedded DB but easy in Firebird embedded.

In HSQLDB embedded (default v1.8), it may be best to define a new table with the wanted structure then copy and paste the data from the old table into the new table taking care to match the fields correctly.

For Firebird embedded (default v3.0 with Experimental features enabled) you can use SQL:

Syntax: ALTER TABLE tablename ALTER [COLUMN] colname POSITION <newpos>

Example: ALTER TABLE salary_history2 ALTER old_salary POSITION 2

From Firebird documentation:
The POSITION keyword changes the position of an existing column in the notional “left-to-right” layout of the record.
Numbering of column positions starts at 1.
• If a position less than 1 is specified, an error message will be returned
• If a position number is greater than the number of columns in the table, its new position will be adjusted silently to match the number of columns.

Other databases may differ. You have not stated which database you are using. Base itself is not a database but rather a front end to a database.