SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
N-1
N
NAME Command
NAME is an SQLCI report writer command that assigns an alias to a column in the
select list of the SELECT command. You can then use the alias to refer to the column
in any other part of your report definition.
NAME is convenient for defining abbreviations for long column names or for assigning
informative names to columns that consist of expressions.
column
identifies a column in the select list of the SELECT command. It can be a column
name, an alias, or COL number (which specifies the position of the column in the
select list). It cannot be a detail alias.
alias
is an SQL identifier that is unique among column names in the select list and
among existing aliases. It becomes the alias for the specified column.
Consideration—NAME Command
If you specify an alias, it becomes the default heading for the column. If you specify
more than one alias for the same column, the most recently defined alias is the default
heading.
Example—NAME Command
This example defines an alias for the second column in a select list. The output shows
the effect of the alias on the heading.
>> SET LIST_COUNT 0;
>> SELECT EMPNUM, SALARY/12 FROM PERSNL.EMPLOYEE;
S> NAME COL 2 MONTHSAL;
S> DETAIL EMPNUM, MONTHSAL;
S> TOTAL MONTHSAL;
S> LIST FIRST 1;
EMPNUM MONTHSAL
------ --------------------
1 14625.000000000000
NAME column alias ;