tags:

views:

105

answers:

1

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?

A: 

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)

SquareCog