|
Transact-SQL User's Guide
|
Renaming
columns in query results
When
query results display, the default heading for each column is the name
given to it when it was created. You can rename a column heading for
display purposes by using one of the following instead of only the column
name in a select list.
column_heading = column_name
or:
column_name column_heading
or:
column_name as column_heading
This provides a substitute name for the column. For example,
to change pub_name to "Publisher" in
the previous query, type any of the following statements:
select Publisher = pub_name, pub_id
from publishers
select pub_name Publisher, pub_id
from publishers
select pub_name as Publisher, pub_id
from publishers
The
results of these statements look like this:
Publisher pub_id
---------------------- ------
New Age Books 0736
Binnet & Hardley 0877
Algodata Infosystems 1389
(3 rows affected)