1

As mentioned in the title, I am unable to perform some simple query using the AS keyword. For example

SELECT COLUMN1 AS TESTING FROM TESTINGTABLE;

I get the following result.

COLUMN1
-------------
VALUE1

instead of

TESTING
--------------
VALUE1

However for

select 'abcd' as TESTING from sysibm.sysdummy1; 

I can get the following result

TESTING
--------------
abcd

Please help to give some direction... my db2 version is DB2 v11.1.0.1527

mustaccio
  • 18,234
  • 16
  • 48
  • 57
Jack
  • 87
  • 1
  • 14
  • Possible duplicate of [Column aliasing in SELECT statements doesn't work with SQuirrel SQL + Firebird](http://stackoverflow.com/questions/12709814/column-aliasing-in-select-statements-doesnt-work-with-squirrel-sql-firebird) – mustaccio Jan 25 '17 at 13:12
  • 1
    See this [page in the manual](http://www.ibm.com/support/knowledgecenter/SSEPGG_11.1.0/com.ibm.db2.luw.apdv.java.doc/src/tpc/imjcc_c0052593.html) and try setting the JDBC connection property `useJDBC4ColumnNameAndLabelSemantics` – mustaccio Jan 25 '17 at 13:16
  • You might need to provide some more context: **where are you having this problem**? – Mark Rotteveel Jan 27 '17 at 13:44
  • @MarkRotteveel i encounter this issues in sql developer, i connect to my db2 database after imported db2jcc4.jar – Jack Feb 02 '17 at 02:13
  • @mustaccio i using sql developer to check the result.... – Jack Feb 02 '17 at 02:14

1 Answers1

0

strange, try this formats:

SELECT COLUMN1 TESTING FROM TESTINGTABLE;

or this :

SELECT COLUMN1 AS "TESTING" FROM TESTINGTABLE;
Esperento57
  • 16,521
  • 3
  • 39
  • 45