
It may be different for your instance but is a good starting point.
EXCEL FOR MAC 2016 SORT COLUMN ALPHABETICALLY CODE
This code should arranged my index first and then organise all other columns from A-Z. I created one for a couple of the tables in which my users prefer the alphabetic layout while still using the simplified SELECT * statement. And presentation of the data is something that should probably be done by the presentation layer, not the DBMS itself - the DBMS should be left to return the data in as efficient a manner as possible.Ī different approach would be to arrange all columns alphabetically by altering the table via a SQL procedure. However, you really should critically examine all queries that select * - in the vast majority of cases, it's unnecessary and inefficient. Now you have the rs recordset with sorted columns.

" where owner = 'pax' and table_name = 'movies'" + Then you use the results of that query to construct the real query: query1 = "select column_name from sysibm.syscolumns" + Where owner = 'pax' and table_name = 'movies' Something like: select column_name from sysibm.syscolumns This is non-portable but most DBMS' supply these table (such as DB/2's SYSIBM.SYSCOLUMNS) and you can select the column names from there in an ordered fashion. You also have the other possibility of using the DBMS data definition tables to dynamically construct a query. Now you may not want to do that but sometimes life isn't fair :-) You'd find that they probably came out in that order (though I'm not sure SQL standards mandate this). SQL itself doesn't care what order the columns come out in but, if you were to use: select age, name, sex from.
