Re: Cannot Reference Named Column in WHERE Clause
- From: "Russell Fields" <russellfields@xxxxxxxxxx>
- Date: Tue, 13 May 2008 14:42:27 -0400
Doug,
That is not defined to work in TSQL. You have not renamed the column in the
select statement, just gave the column a different header. The WHERE still
needs to be told the actual column name. I don't think that this ever
worked, but my memory of ancient days may be fading.
The ORDER BY is ordering the result set, so it can be argued that since this
step comes after the query, it now knows the result set's column name.
RLF
"Chaplain Doug" <ChaplainDoug@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0C2F8299-DA6E-4216-B628-779CD927A8A6@xxxxxxxxxxxxxxxx
SQL Server 2005.
I have a view defined for a database. Part of the query is:
SELECT dbo.GL7PROJECTS.PROJECTID AS JURISDICTION
I have not problem using JURISDICTION in the ORDER BY clause, but when I
try
to use it in a WHERE clause (e.g., WHERE JURISDICTION LIKE '001%') I get
an
error (while in the SQL Server Management Studio) saying:
Invalid column name 'JURISDICTION'
What might be causing this and why does it not work??? Thanks for the
help.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org
.
- References:
- Cannot Reference Named Column in WHERE Clause
- From: Chaplain Doug
- Cannot Reference Named Column in WHERE Clause
- Prev by Date: Cannot Reference Named Column in WHERE Clause
- Next by Date: How to Combine LIKE and IN
- Previous by thread: Cannot Reference Named Column in WHERE Clause
- Next by thread: How to Combine LIKE and IN
- Index(es):
Relevant Pages
|
|