Reputation: 1128
Can I select the columns by column number like for example
select custome.0, customer.1 from customer
table customer with id and name as columns?
Upvotes: 1
Views: 5599
Reputation: 19676
Not quite what you are asking for, but if you are willing to pay for a round trip you may be able to use this query to find the column name to column number mapping:
SELECT COLNAME, COLNO, TYPENAME, NULLS FROM SYSCAT.COLUMNS
WHERE TABSCHEMA = ? and TABNAME = ? order by colno
(from Perl's DBI::DB2)
Upvotes: 2