Home All Groups Group Topic Archive Search About

LABEL ON not part of sql server?

Author
29 Mar 2005 6:11 PM
Steve Richter
in sql server, how do I specify the column heading of a column?  That
is a column heading other than the column name.

in the little sql I know, in the SQL on the IBM AS400, the following is
permitted:

Example 1: Enter a label on the DEPTNO column of table DEPARTMENT.
LABEL ON COLUMN DEPARTMENT.DEPTNO IS 'DEPARTMENT NUMBER'

thanks,

-Steve

Author
29 Mar 2005 7:11 PM
Peter van der Goes
Show quote
"Steve Richter" <StephenRich***@gmail.com> wrote in message
news:1112119904.066906.277920@f14g2000cwb.googlegroups.com...
> in sql server, how do I specify the column heading of a column?  That
> is a column heading other than the column name.
>
> in the little sql I know, in the SQL on the IBM AS400, the following is
> permitted:
>
> Example 1: Enter a label on the DEPTNO column of table DEPARTMENT.
> LABEL ON COLUMN DEPARTMENT.DEPTNO IS 'DEPARTMENT NUMBER'
>
> thanks,
>
> -Steve
>
Try SELECT column_name AS alias where column_name is the actual database
column name and alias is the column name you want to display in the query
results.


--
Peter [MVP Visual Developer]
Jack of all trades, master of none.
Author
29 Mar 2005 7:40 PM
Steve Richter
Peter van der Goes wrote:
Show quote
> "Steve Richter" <StephenRich***@gmail.com> wrote in message
> news:1112119904.066906.277920@f14g2000cwb.googlegroups.com...
> > in sql server, how do I specify the column heading of a column?
That
> > is a column heading other than the column name.
> >
> > in the little sql I know, in the SQL on the IBM AS400, the
following is
> > permitted:
> >
> > Example 1: Enter a label on the DEPTNO column of table DEPARTMENT.
> > LABEL ON COLUMN DEPARTMENT.DEPTNO IS 'DEPARTMENT NUMBER'
> >
> > thanks,
> >
> > -Steve
> >
> Try SELECT column_name AS alias where column_name is the actual
database
> column name and alias is the column name you want to display in the
query
> results.
>

thanks Peter. 

-Steve
Author
30 Mar 2005 4:58 AM
Dave Fancher
Although this should probably be directed to a SQL Server group, you can
alias the column like this:

SELECT DEPTNO [DEPARTMENT] -- Other columns go here
FROM DEPARTMENTS d    -- d is an alias for the DEPARTMENTS table

The brackets aren't really necessary in this case but help make it a bit
more readable.  The brackets become necessary when violating any SQL Server
naming rules.

HTH
----------------
Dave Fancher
http://davefancher.blogspot.com
Show quote
"Steve Richter" <StephenRich***@gmail.com> wrote in message
news:1112119904.066906.277920@f14g2000cwb.googlegroups.com...
> in sql server, how do I specify the column heading of a column?  That
> is a column heading other than the column name.
>
> in the little sql I know, in the SQL on the IBM AS400, the following is
> permitted:
>
> Example 1: Enter a label on the DEPTNO column of table DEPARTMENT.
> LABEL ON COLUMN DEPARTMENT.DEPTNO IS 'DEPARTMENT NUMBER'
>
> thanks,
>
> -Steve
>

AddThis Social Bookmark Button