Cannot Reference Named Column in WHERE Clause



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
.



Relevant Pages

  • Re: Cannot Reference Named Column in WHERE Clause
    ... just gave the column a different header. ... step comes after the query, it now knows the result set's column name. ... I have not problem using JURISDICTION in the ORDER BY clause, ...
    (microsoft.public.sqlserver.mseq)
  • Re: The Many Flavors of SQL - Can a SQL Server query work in MS Access?
    ... One thing is that if you have more than one join in the From clause you have to use Parentheses ... You might try building the base of the query using the query grid. ... inner join cmsopen.dbo.apm_vendor v ... in the Query Analyzer on a Windows 2000 Server box running SQL Server ...
    (microsoft.public.access.queries)
  • Re: ORDER BY in VIEW not working
    ... SQL Server is NOT guaranteed to repect an ORDER BY ... in the view unless you use ORDER BY also when you *query* the view. ... CREATE VIEW TopView AS ... Although the view definition contains an ORDER BY clause, ...
    (comp.databases.ms-sqlserver)
  • Re: Can anyone help with Data Designer issue?
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... debug what the command is sending to the Access database for any ... This query uses parameters and I'm afraid it's not sending the where ... as soon as I put in this where clause: ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Can anyone help with Data Designer issue?
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... debug what the command is sending to the Access database for any ... This query uses parameters and I'm afraid it's not sending the where ... as soon as I put in this where clause: ...
    (microsoft.public.dotnet.framework.adonet)