Re: SELECT 42 AS a, a AS b FROM system.iota
- From: Luc Van der Veurst <dba_azvub@xxxxxxxxxxx>
- Date: 13 Feb 2008 13:38:16 GMT
dtmackenzie <david.mackenzie@xxxxxxxxxxxx> wrote:
I'm wondering if a is a column of system.iota ...
David, does "select a as b from system.iota" work ?
Luc.
Luc, system.iota in ADS has only one row and one column, which is also
named "iota".
As expected "select a as b from system.iota" returns an error message
that column "a" doesn't exist.
My example is reduced to a minimum for demonstration purposes but it's
not just a theoretical problem - in the real SELECT there is a longer
expression instead of "42" which I would like to avoid repeating in
several places (which clutters up the code and hinders maintenance).
Yes, that's what I thought, but by reducing an example, it can
become unclear what you want to achieve. Your question is
kind of ambiguous : it can be interpreted as "can I give an item
in the select list the same name as the name of a column", while you
mean "can I make a reference to an item in the select list further in the
query by using the name I gave it" :-).
What you want doesn't work in ASE (spid is a columnname of sysprocesses) :
select spid as a, a as b from sysprocesses;
Msg 207, Level 16, State 4
Server 'DSP_ST_1_b', Line 1
Invalid column name 'a'.
Luc.
.
- Follow-Ups:
- Re: SELECT 42 AS a, a AS b FROM system.iota
- From: dtmackenzie
- Re: SELECT 42 AS a, a AS b FROM system.iota
- References:
- SELECT 42 AS a, a AS b FROM system.iota
- From: dtmackenzie
- Re: SELECT 42 AS a, a AS b FROM system.iota
- From: mpeppler@xxxxxxxxxxx
- Re: SELECT 42 AS a, a AS b FROM system.iota
- From: Luc Van der Veurst
- Re: SELECT 42 AS a, a AS b FROM system.iota
- From: dtmackenzie
- SELECT 42 AS a, a AS b FROM system.iota
- Prev by Date: Re: SELECT 42 AS a, a AS b FROM system.iota
- Next by Date: Re: SELECT 42 AS a, a AS b FROM system.iota
- Previous by thread: Re: SELECT 42 AS a, a AS b FROM system.iota
- Next by thread: Re: SELECT 42 AS a, a AS b FROM system.iota
- Index(es):
Relevant Pages
|