SSIS error - value violated the schema's const

2019-06-08 02:18发布

问题:

Exporting from sql server to excel with ssis. export gets around 80% through writing to the excel file then fails with this error. It stops at the same row each time. The value in the field being written is the well within the length parameter and contains no funky characters. Because 35 rows pass through successfully and write to the excel file, I assume the data type is correct (nvarchar(max) in sql server, DT_WSTR(4000) in SSIS). What other things can trigger this error? Using SSIS 2008, excel 2007 output file.

Error message:

Error: 0xC0202009 at Data Flow Task 1, Excel Destination [1380]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x00040EDA. Error: 0xC020901C at Data Flow Task 1, Excel Destination [1380]: There was an error with input column "Chemicals" (1454) on input "Excel Destination Input" (1391). The column status returned was: "The value violated the schema's constraint for the column.".

Error: 0xC0209029 at Data Flow Task 1, Excel Destination [1380]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "Excel Destination Input" (1391)" failed because error code 0xC0209076 occurred, and the error row disposition on "input "Excel Destination Input" (1391)" 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 Data Flow Task 1, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Excel Destination" (1380) failed with error code 0xC0209029 while processing input "Excel Destination Input" (1391). 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:

I beleive the limit for a single Excel column is actually 255 characters. I would test for longer values upstream in the SSIS flow and either split out those rows or truncate long data using a Derived Column.