locked
Conditional Split Column < Today RRS feed

  • Question

  • Hey guys, I'm trying to write a conditional split where I want to bring in only records where the date is less than today, but my problem is that I can't simply do this Column < GetDate() because if something comes in today, it takes the time into account and it will bring that record for today.  You can do this in SQL, but I'm not sure how to do that in SSIS

    SELECTCAST(CONVERT(char(8),GetDate(),112)ASdatetime)

    Thursday, October 29, 2015 1:43 AM

Answers

  • Hi Diango,

    According to your description, you want to exclude the time part for the result of GetDate(), so that you can filter date that less than today.

    To achieve your requirement, we need use the expression to exclude the time part for the result of GetDate() like below:
    (DT_DATE)(LEFT((DT_WSTR,100)(GETDATE()),10))

    If there are any other questions, please feel free to ask.

    Thanks,
    Katherine Xiong


    Katherine Xiong
    TechNet Community Support

    • Marked as answer by Diango Thursday, October 29, 2015 5:11 PM
    Thursday, October 29, 2015 3:01 AM

All replies

  • Hi Diango,

    According to your description, you want to exclude the time part for the result of GetDate(), so that you can filter date that less than today.

    To achieve your requirement, we need use the expression to exclude the time part for the result of GetDate() like below:
    (DT_DATE)(LEFT((DT_WSTR,100)(GETDATE()),10))

    If there are any other questions, please feel free to ask.

    Thanks,
    Katherine Xiong


    Katherine Xiong
    TechNet Community Support

    • Marked as answer by Diango Thursday, October 29, 2015 5:11 PM
    Thursday, October 29, 2015 3:01 AM
  • Thank you Katherine! It works well.
    Thursday, October 29, 2015 5:11 PM