Derived Column Data Conversion

  • Hi all,

    im trying to display an integer column from an employee to "uknown" if its Null in Derived column in SSIS but i have data conversion error. Now there is a list of Null functions available but I am quite new to this and i don't know which one to pick and where to place exactly. Please suggest.

    ISNULL (DT_I4)(DepartmentID) ? (DT_I4)" Uknown" : (DT_I4)DepartmentID ====>> Error

  • Not sure if I got the specs right but, try this:

    (ISNULL(DT_I4) ? "" : DT_I4) + (ISNULL(DepartmentID) ? "Unknown" : DepartmentID)

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • You cannot put "unknown" in an integer column. You need to cast it to a string column.

    ISNULL(DepartmentID) ? (DT_STR,7,1252)"Unknown" : (DT_STR,7,1252)DepartmentID

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

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

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