Welcome to Sign in | Help

Re: probleme cu AS

  •  09-03-2007, 12:58 PM

    Re: probleme cu AS

    Nu se poate , iata alta dovada:

    daca lansez :

    select occupationlabel as a,

    (case when occupationlabel='EXEC VICE PRES' then 'exec' else 'nu e ok' end) as b

    from dbo.occupation

    rezulta

    a b

    -------------------------------------------------- -------

    EXEC VICE PRES exec

    FIELDS OPS MGR nu e ok

    BUS OFFICE MGR nu e ok

    X-RAY TECH nu e ok

    (4 row(s) affected)

     

    daca lansez

    select occupationlabel as a,

    (case when a='EXEC VICE PRES' then 'exec' else 'nu e ok' end) as b

    from dbo.occupation

     

    rezulta :

    Msg 207, Level 16, State 1, Line 2

    Invalid column name 'a'.

    Concluzia , nu folositi aliasul in case ... end


    Gheorghe Ciubuc,SQL Server Influencer, MCP(SQL 2000), MCTS (SQL Server 2005) , OCA(Oracle 9i), Sybase(Brainbench)
View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems