Case statment in Derived Column

  • Is there a way to created a derived column expression based on a Case Statement or how would I convert it into a appropriate expression?

    code:

    UPDATE newvolume.Volume

    SET PaidAtLevelXID =

    case b.PaidAtLevelText

    when 'Non-Active Consultant' then 10

    when 'Consultant' then 20

    when 'Senior Consultant' then 30

    when 'Team Leader' then 40

    when 'Team Manager' then 50

    when 'Senior Team Manager' then 60

    when 'Team Mentor' then 70

    when 'Senior Team Mentor' then 80

    end

    From newvolume.Volume b

    Thanks,
    Art
    Database Analyst
    Tastefully Simple, Inc.

    alorenzini@tastefullysimple.com
    " Some days, it's not even worth chewing through the restraints!

  • alorenzini (7/1/2008)


    Is there a way to created a derived column expression based on a Case Statement or how would I convert it into a appropriate expression?

    code:

    UPDATE newvolume.Volume

    SET PaidAtLevelXID =

    case b.PaidAtLevelText

    when 'Non-Active Consultant' then 10

    when 'Consultant' then 20

    when 'Senior Consultant' then 30

    when 'Team Leader' then 40

    when 'Team Manager' then 50

    when 'Senior Team Manager' then 60

    when 'Team Mentor' then 70

    when 'Senior Team Mentor' then 80

    end

    From newvolume.Volume b

    Yes - but this particular one probably belongs in a reference table. That being said - you should be able to take your case statement pretty much as is in a dervied column.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • I added it as a lookup and it works fine. But I would still like to know how I can right it as a nested expression if you could help.

    Thanks,
    Art
    Database Analyst
    Tastefully Simple, Inc.

    alorenzini@tastefullysimple.com
    " Some days, it's not even worth chewing through the restraints!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply