Using quoted string in AS cluase of Select
Posted in 2009
Topics: Stored Procedures & SPL
I have a requirement to alias a column name with a display_label like :
SELECT name AS Name of Employee from employee;
Above statement gives error in Informix, but other database (Oracle,MSS/sybase
) we can use quoted string to achieve this which doesn't work for Informix:
SELECT name AS "Name of Employee" from employee;
Anyidea, how do I make this working.
Thanks,
You need to set DELIMIDENT environment variable to make this work. For example,
$ dbaccess testdb -
Database selected.
> select name as "Name of Employee" from employee;
201: A syntax error has occurred.
Error in line 1Near character position 16
$ export DELIMIDENT=1
$ dbaccess testdb -
Database selected.
> select name as "Name of Employee" from employee;
Name of Employee John Smith
1 row(s) retrieved.
thanx
Prasad
Thanks Prasad for your help.