0
votes

whats the correct datatype to use in SSIS for the following Metadata on SQL Server table.

[End Date] DATA_TYPE=-9 TYPE_NAME=date  PRECISION=10    LENGTH=20

I'm trying to load data from excel source to ole db destination and i'm getting the following errors

[OLE DB Destination [116]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Invalid character value for cast specification". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Invalid character value for cast specification".

[OLE DB Destination [116]] Error: There was an error with OLE DB Destination.Inputs[OLE DB Destination Input].Columns[End Date] on OLE DB Destination.Inputs[OLE DB Destination Input]. The column status returned was: "The value could not be converted because of a potential loss of data.".

[OLE DB Destination [116]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "OLE DB Destination.Inputs[OLE DB Destination Input]" failed because error code 0xC0209077 occurred, and the error row disposition on "OLE DB Destination.Inputs[OLE DB Destination Input]" 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.

[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "OLE DB Destination" (116) failed with error code 0xC0209029 while processing input "OLE DB Destination Input" (129). 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.

1
What datatype are you using when you get the error?Tab Alleman
For [End Date] in the OLE DB Destination, under 'External columns' i'm using 'database time [DT_DBTIME]' and under Input columns i'm using 'DT_DATE' to the column [Copy of End Date] from 'Derived column' transformationivric
Also [End Date] on Excel source 'External columns' is Unicode string [DT_WSTR] and on 'Output columns' its date [DT_DATE]ivric

1 Answers

1
votes

Oftentimes when I'm loading dates and datetimes from flatfiles or Excel, I end up using a string (dt_str) and then casting it to a date/datetime in SQL.

I have had some luck having the flatfile data type be a dt_str but still having the SQL table be a datetime. Somehow it gets implicitly converted. But depending on the format of the date, this fails and I end up doing the cast approach.

I might also add, that Excel has been a troublesome source in my experience. If you can save as a .CSV or some other flat file, it seems to work better.