Showing posts with label SSIS. Show all posts
Showing posts with label SSIS. Show all posts

Saturday, April 10, 2021

Fix SSIS Error 0xC0202092: Handling CSV Text Qualifiers and Double Quotes

Summary: Troubleshooting SSIS Flat File Source errors (DTS_E_PRIMEOUTPUTFAILED) when importing CSV files with complex text qualifiers. Learn how to adjust Connection Manager properties to resolve fatal pipeline execution errors.

Resolving SSIS CSV Import Errors with Text Qualifiers

Importing CSV files into SQL Server via SSIS is usually straightforward, but "dirty" data—specifically strings enclosed in double quotes that contain nested quotes or commas—can trigger fatal pipeline errors.


The Problem: Sample CSV Data

In the example below, row four contains a nested quote within the text qualifier, which often confuses the SSIS parser:


"090","Grey",""
"091","Grey, Red",""
"092","White/Teal",""
"042","Blue ","(\"is not blue\" )"  -- Nested quotes causing parser failure
"093","Light Grey",""
        

Common Error Message


[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. 
The PrimeOutput method on Flat File Source returned error code 0xC0202092. 
This error is fatal and stops pipeline execution.
        

The Solution: Adjusting Connection Manager Properties

When the automatic parser fails to identify the boundaries of a column due to conflicting qualifiers, you can manually override the behavior in the Flat File Connection Manager.

Step 1: Navigate to the Advanced Tab and select the problematic column.

Step 2: Locate the TextQualified property and set it to False.

By setting this to false, SSIS treats the qualifiers as literal data, which prevents the PrimeOutput method from crashing when it encounters unexpected quote patterns.

Note: If you set TextQualified to False, the double quotes will be imported into your database table. You can easily remove them later using a REPLACE(Column, '"', '') command in SQL or a Derived Column transformation in SSIS!