You can declare a view on the base table which returns the columns in
the order you need. DatabaseMetaData.getColumns() will return the view's
columns in the desired order.
Hope this helps,
-Rick
Dag H. Wanvik wrote:
Daniel Noll <[email protected]> writes:
Bryan Pendleton wrote:
I saw the "alter table" only insert the column to the end of the table,
Yes, but you can retrieve your columns in any order. For example:
create table t (a int, b int, c int, d int);
alter table t add column e int;
What if they're using some kind of application which reads the
database metadata and automatically generates a form based on the
columns present in the table?
You could use a temporary table, copy the data there, drop the
original table and recreate it with the new column with a suitable
default and put back the data in the old columns like this:
insert into t2 (oldcol1, oldcol2, ..) select * from tmptab;
Dag