Nested IFs in Derived column transformation

  • I'm not sure how to go about this.  I have a series of dates that are strings in the input (month/day/year):

    4/23/2012
    1/21/2013
    3/4/2013
    04/02/2015

    I am using a derived column to transform them into output database timestamp [DT_DBTIMESTAMP].  I need to build a nested IF statement that converts the month to two characters if it is a single character and the day to two characters if it is a single character. Then I am converting the entire date to a database timestamp [DT_DBTIMESTAMP] if the length is 0.

    Any help is appreciated!

  • karen.ferrara - Monday, December 11, 2017 6:03 AM

    I'm not sure how to go about this.  I have a series of dates that are strings in the input (month/day/year):

    4/23/2012
    1/21/2013
    3/4/2013
    04/02/2015

    I am using a derived column to transform them into output database timestamp [DT_DBTIMESTAMP].  I need to build a nested IF statement that converts the month to two characters if it is a single character and the day to two characters if it is a single character. Then I am converting the entire date to a database timestamp [DT_DBTIMESTAMP] if the length is 0.

    Any help is appreciated!

    You don't need an IF for this. Instead, use:

    RIGHT( "0" +[MonthExpression],2)

    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.

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

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