Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to specify column header titles in a SQL CREATE TABLE statement?

Re: How to specify column header titles in a SQL CREATE TABLE statement?

From: Philip Sherman <psherman_at_ameritech.net>
Date: Wed, 13 Oct 2004 12:38:11 GMT
Message-ID: <Tk9bd.14602$Bw.1873@newssvr31.news.prodigy.com>


Rhino wrote:

> If you want embedded blanks within the column heading, you need to embed the
> column heading within quotes. For example:
>
> select lastname as "Employee Last Name", salary as "Employee Pay"
> from employee
> where empno in ('000010', '000020');
>
> results in
>
> EMPLOYEE LAST NAME EMPLOYEE PAY
> -------------------------- -----------------
> HAAS 52750.00
> THOMPSON 41250.00
>
> [Please note that I "took some liberties" with the result sets shown in
> these examples due to the proportional fonts used in my newsreader. In the
> real world:
> - the lastname values will be left-justified under the LASTNAME heading
> - the salary values will be right-justified under the SALARY heading.
> - the headings will always be uppercase if the query is executed in the DB2
> command line but will match the case of the query if the query is executed
> in the Command Center]

Headings specified in the "as" clause will be used EXACTLY AS RECEIVED by the DB2 command processor. If you are getting folding to upper case then you are most likely not correctly specifying the column headings.

Under RHEL3, UDB 8.1 FP7:

db2 "select lastname as ""Lastname"" from employee where lastname like 'L%'"

LASTNAME



LUCCHESSI
LUTZ
LEE appears correct and returns the data but does not have the correct column heading! The operating system command line processor gets this long before DB2 does and alters it.

db2 "select lastname as \"Lastname\" from employee where lastname like 'L%'"

Lastname



LUCCHESSI
LUTZ
LEE yields exactly the results that are expected.

Phil Sherman Received on Wed Oct 13 2004 - 07:38:11 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US