Why would you like to re-order the column order?
There are some advanced technical reasons to do so (PKs should be among the first columns, variable-length or "wide" columns should be put at the end, more on this here...) for optimal performance, but in general the column order is rather irrelevant from the database system's point of view - IMHO it's usually more a human need to order columns "logically".
When you code a SELECT statement, you can obviously use whatever column order you like...
But otherwise, Thomas is absolutely right: There is no way to re-arrange the column order of an existing table (though this has beed discussed in the newsgroups in the past several times). So you will have to create a new table with the desired column order.
FWIW: Here's a link to a verrrry long discussion from 2006 on that topic in the "Product Futures newsgroup"...
Depending on the version of SQL Anywhere the Create Table / Insert / and Select can be combined into one step.
However to answer your question simply, yes.
lets say you have table a1 with the old column order of a,d,c,g,b,e,f
and you have newly created table a2 with desired column order of a,b,c,d,e,f,g
You would perform the following:
INSERT INTO TABLE A2 ( a,b,c,d,e,f,g ) SELECT a,b,c,d,e,f,g from A1 ;
answered 09 Apr '12, 06:14