Simple select using calculated column

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Earl Teigrob (earlt777_at_hotmail.com)
Date: 03/03/04


Date: Wed, 3 Mar 2004 11:34:29 -0600

I have a query like

select dbo.function(column) as newcol
from tablename
where newcol=0

everything works fine without the where clause
but when I add it, I get an error that newcol is an invalid column name

I am sure that I have done this before (quite a while ago) but can not
remember the syntax

Thanks for the help

Earl



Relevant Pages

  • Re: Alter table and update with ADO
    ... > alter table ... > add NEWCOL integer; ... >The query fails with 'Field newcol not found'. ...
    (borland.public.delphi.database.ado)
  • Alter table and update with ADO
    ... I am using an ADO SQLQuery to check to see if structure updates are needed ... AND Name = 'NEWCOL' ... The query fails with 'Field newcol not found'. ...
    (borland.public.delphi.database.ado)
  • Re: Simple select using calculated column
    ... You cannot refer to a column alias in the query (the one exception is in ... select dbo.functionas newcol ... "Earl Teigrob" wrote in message ... > I have a query like ...
    (microsoft.public.sqlserver.programming)
  • Re: Simple select using calculated column
    ... from tablename) X ... select dbo.functionas newcol ... Vishal Parkar ...
    (microsoft.public.sqlserver.programming)
  • Re: Replacement of values within a string
    ... SELECT @OrgCol = ColumnName FROM TableName ... -- Write your update statement here or return @NewCol if a UDF ...
    (microsoft.public.sqlserver.server)