Errors in SQL Server while importing CSV file despite varchar(MAX)

You can use CSV or TEXT files for data transfers with Sql Server Management Studio. If the nvarchar fields in the table you will import are defined as MAX, you may see an error message. You go through the Import Wizard and finally try to import the file you get the following error report:

Executing (Error) Messages

Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data conversion for column “Detail” returned status value 4 and status text “Text was truncated or one or more characters had no match in the target code page.”.(SQL Server Import and Export Wizard)

Error 0xc020902a: Data Flow Task 1: The “Source – Train_csv. Outputs[Flat File Source Output].Columns[“Detail”]” failed because truncation occurred, and the truncation row disposition on “Source – Sample_csv.Outputs[Flat File Source Output].Columns[“Detail”]” specifies failure on truncation. A truncation error occurred on the specified object of the specified component.

(SQL Server Import and Export Wizard)Error 0xc0202092: Data Flow Task 1: An error occurred while processing file “C:\Sample.csv” on data row 2.(SQL Server Import and Export Wizard)Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Source – Sample_csv returned error code 0xC0202092. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.(SQL Server Import and Export Wizard)

To solve the problem, go to the “Advanced” tab on the source screen where you have selected FLAT File, select “DT_TEXT” instead of “DT_STR” and continue the process.

Add a Comment

Your email address will not be published. Required fields are marked *