I want to give a conditional statement in dervied column

  • I want to give conditional statement in dervied column by adding a new column.In band column if Band is B1 then in new column it should be Manager like this If band=C1 then in new column it should be as Developer and if Band=B2 then in new column of that row should be as Tech Lead.How to do this

  • krishnasrisatya (12/28/2012)


    I want to give conditional statement in dervied column by adding a new column.In band column if Band is B1 then in new column it should be Manager like this If band=C1 then in new column it should be as Developer and if Band=B2 then in new column of that row should be as Tech Lead.How to do this

    I'd do this using a lookup rather than a derived column. First create a new table (Band, Description) containing the lookup rows:

    B1, Manager

    C1, Developer

    B2, Tech Lead

    And then add an appropriate lookup in your data flow to grab the description. This means that you can accommodate any description changes or additional bands easily without any package changes being necessary.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • (DT_STR,50,1252)(band == "C1" ? "Developer" : band == "C2" ? "Tech Lead" : "Something Else")

    I added the string conversion "(DT_STR,50,1252)" incase you are inserting into a varchar field. If you are inserting into nvarchar you wont need it.

  • ngreene (12/28/2012)


    (DT_STR,50,1252)(band == "C1" ? "Developer" : band == "C2" ? "Tech Lead" : "Something Else")

    I added the string conversion "(DT_STR,50,1252)" incase you are inserting into a varchar field. If you are inserting into nvarchar you wont need it.

    This never returns Manager.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • I typed logic wrong, but it demonstrates how to do it.

Viewing 5 posts - 1 through 4 (of 4 total)

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