locked
Formula in Derived Column to replace the NULL for datetype RRS feed

  • Question

  • I have table in SQL with data like this:

    ReceptionDate          SupplyDate     СaseID 

    NULL                     2009-06-04           11

    NULL                     2009-06-04           12

    2009-06-02            2009-07-05          13 

    NULL                     2009-06-05           14

    NULL                     2009-06-06           15

    NULL                     2009-06-07           16

    I need the formula in SSIS (Derived Column) to replace NULL from ReceptionDate to data  with content :

    If the ReceptionDate     is NULL do this:  ReceptionDate=     SupplyDate - one month.

    For instance for the CaseID  “11” I want to see row like this:

    ReceptionDate          SupplyDate     СaseID

    2009-05-04              2009-06-04         11

    Thank you

    Friday, February 24, 2012 8:30 PM

Answers

  • ISNULL([ReceptionDate]) ? DATEADD("Month",-1,[SupplyDate]) : [ReceptionDate]



    Arthur My Blog

    • Proposed as answer by SSISJoostMVP Friday, February 24, 2012 8:49 PM
    • Marked as answer by EliLeiz Saturday, February 25, 2012 7:39 AM
    Friday, February 24, 2012 8:47 PM

All replies

  • ISNULL([ReceptionDate]) ? DATEADD("Month",-1,[SupplyDate]) : [ReceptionDate]



    Arthur My Blog

    • Proposed as answer by SSISJoostMVP Friday, February 24, 2012 8:49 PM
    • Marked as answer by EliLeiz Saturday, February 25, 2012 7:39 AM
    Friday, February 24, 2012 8:47 PM
  • It works perfectly,thank you very much!!!
    Saturday, February 25, 2012 7:39 AM