Date data causing "Invalid character value for cast specification" in SSIS

21,382

Try bringing it into a varchar() or other string or text-type field instead of a date field. Some back ends accept dates SQL Server can't handle directly so they need to be converted before the import.

Share:
21,382
RLH
Author by

RLH

Updated on January 14, 2020

Comments

  • RLH
    RLH over 4 years

    I have an SSIS exportation package that is used to export data from an iSeries System into SQL Server. I'm adding a new table export to the package and this table includes two date fields. My SSIS package connects to the to the iSeries database through ODBC. I can connect to the data table that I want to export from with no problem in MS Access and I can browse and view all of the data without any trouble. However, I'm getting a dreaded "Invalid character value for cast specification" error message from SSIS on my date fields.

    How can I diagnose the specific problem? I'm pretty sure there is probably some way to convert this data in SSIS, I just don't know how to reformat the data since I can't preview it in it's original state from MS Access. My question is pretty generic-- What can I do to either fix this problem or troubleshoot the problem?

    Thanks devs! FYI, the data below is the full error details from Visual Studio when I test the task.

    Error: 0xC0202009 at [iSeriesTable], [SSIS Task] [113]: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.
    An OLE DB record is available.  Source: "Microsoft SQL Native Client"  Hresult: 0x80004005  Description: "Invalid character value for cast specification".
    Error: 0xC020901C at [iSeriesTable], [SSIS Task] [113]: There was an error with input column "date_field" (178) on input "OLE DB Destination Input" (126). The column status returned was: "Conversion failed because the data value overflowed the specified type.".
    Error: 0xC0209029 at [iSeriesTable], [SSIS Task] [113]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "input "OLE DB Destination Input" (126)" failed because error code 0xC020907A occurred, and the error row disposition on "input "OLE DB Destination Input" (126)" specifies failure on error. An error occurred on the specified object of the specified component.  There may be error messages posted before this with more information about the failure.
    Error: 0xC0047022 at [iSeriesTable]: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "[SSIS Task]" (113) failed with error code 0xC0209029. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.  There may be error messages posted before this with more information about the failure.
    Error: 0xC0047021 at [iSeriesTable]: SSIS Error Code DTS_E_THREADFAILED.  Thread "WorkThread0" has exited with error code 0xC0209029.  There may be error messages posted before this with more information on why the thread has exited.