trying to get NULL date from Execute SQL task with OLE DB

  • I'm trying to run the following SQL statement. When I run this in SSMS, I get NULL but when I run it with SSIS I get November 19, 1990. The SQL statement is

    SELECT MAX(LastSuccessDate) as minDate FROM TableStats

    How do I get this to return NULL in SSIS?

  • Yes SSIS won't be able to return null value in a date time variable. Also I am not sure why its returning a particular date when the value is NULL.

    I just have a work around for this (I used it in one of my pacakges). In the select query return some value in case the max(LastSuccessDate) is null.

    SELECT COALESCE(MAX(LastSuccessDate),'1/1/1900' as minDate FROM TableStats

    And in your packacge treat this returned value ('1/1/1900') for null case.

    HTH

    ~Mukti

  • Thanks for the response. I'll use your method.

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

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