Transform Data - Date Problem

  • Hi,

    I am getting the following error when processing a Date Field:

    ---------------------------

    Package Error

    ---------------------------

    Error Source : Microsoft OLE DB Provider for SQL Server

    Error Description : The number of failing rows exceeds the maximum specified.

    Insert error, column 9 ('DOB', DBTYPE_DBTIMESTAMP), status 6:  Data overflow.

    Invalid character value for cast specification.

    ---------------------------

    OK  

    ---------------------------

    The source data is MS-Access, the destination MS SQL.

    The following transformation, does not seem to help:

    Function Main()

     

     if IsDate( DTSSource("DOB") ) then

      DTSDestination("DOB") = DTSSource("DOB")

     else

      DTSDestination("DOB") = NULL

     end if

     Main = DTSTransformStat_OK

    End Function

    Any ideas on how to further check the date field to make it play nicely?

  • did u specify the destination date field should not contain null value?

  • not sure what you mean.

    I made the user fix the data, and warned them about being more careful with their data entry.

  • Use ON ERROR instead on date casts.

    Function Main()

    On Error Resume Next

    DTSDestination("DOB") = DTSSource("DOB")

    If err then

    err.clear

    DTSDestination("DOB") = NULL

    end if

    Main = DTSTransformStat_OK

    End Function

    It's messy, but the activex IsDate function works with different date range values that the SQL equivalent. Especially since a SQL date can be either smalldatetime or datetime.

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

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