none
SSIS GETDATE() expression returning null or blank value

    Question

  • Using SQL2008 SP3, I have an SSIS package that uses an SQL Task. Within it, I have the following expresion to get the current date and time and insert it in a table:

    SUBSTRING((DT_WSTR, 50) GETDATE(), 1,  FINDSTRING((DT_WSTR, 50) GETDATE(), ".",1) -1)

    it works great 99.9% of the time, yet once in a while, I get the following error message when evaluationg this expression:
    The length -1 is not valid for function "SUBSTRING". The length parameter cannot be negative. Change the length parameter to zero or a positive value.

    So, my guess is that on that run the GETDATE() function returned null or blank or something that was not able to be used by the SUBSTRING function.

    Any ideas what could be wrong? Is it just a hick up in the system?

    Thanks so much for your feeback.


    Paulino

    Wednesday, June 26, 2013 6:30 PM

Answers

All replies