In my java app I running sql query for example:
select rowid as col1, id as col2 from dummy_table
and then, when I use ResultSetMetaData.getColumnNames I expect to get column aliases (col1 and col2), but method returns physical column names.
So, my question is, how to get column aliases using ResultSetMetaData
I use Java 1.6, Jdbc, Sybase
Thanks a lot
Maybe your driver doesn't understand aliased column. Try to invoke ResultSetMetaData.getColumnLabel() to see what it get
I have noticed something similar in MySQL - there, a quick fix is to turn your main query into a sub query, like so:
select v.* from (
select rowid as col1, id as col2 from dummy_table
) as v
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With