SSIS Derived column

  • Hey all,

    I have a data import which has a field which contains dates or NULL. It comes from a CSV file. I am trying to replace all empty values with null with a derived column.

    This is what i have

    LEN( [EXPIRY_DATE] )==0 ? NULL(DT_STR) : [EXPIRY_DATE]

    Obviously being a CSV all data is coming in as text.

    But i am getting this error.

    The expression might contain an invalid token, an incomplete token, or an invalid element. It might not be well-formed, or might be missing part of a required element such as a parenthesis.

    Any ideas?

    Dan

  • First thing is that you are missing 2 arguements in your NULL(DT_STR) element. The format for this should be NULL(DT_STR, <<Length>>, <<Code Page>>).

    Second. What is the data type of the Expiry_Date column? If it is a date column, you want to use the NULL operand with the same data type. The arguements on either side of the : need to have the same data type or it will error on you.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • Turns out you were half way there. I needed

    LEN(EXPIRY_DATE) == 0 ? (DT_STR,50,1252)NULL(DT_STR,50,1252) : (DT_STR,50,1252)EXPIRY_DATE

    Thanks alot for your help.

    Dan

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

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