Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

How to have SSIS escape double quotes within a string in a CSV file destination which also uses double quotes as its string delimiter?

$
0
0

I'm still trying to reproduce an old MS Access automated export Spec in SSIS. All we're doing is running a query, dumping the results into a CSV file, and FTPing the file off to be read somewhere else. Both the Access and SSIS output csv files use double quotes, i.e., ", as their string delimiters.

The old Access version 'knows'  that when a double quote character appears in the middle of a string, it needs to be escaped, i.e., displayed as "", so as not to be mistaken for the ending string delimiter, but I can not reproduce this desired behaviour in the SSIS version.

The Access output correctly shows something like:
2012,"Feb","Monday", "The title was ""How to win"" an election",12

but my SSIS output looks like
2012,"Feb","Monday", "The title was "How to win" an election",12
and this is blowing up the text file reader on the other end, which throws a "Misquoted String" error.

The identical columns of text are stored in the Access tables as Memo data type and in SQL Server as nvarchar(4000).

The Access export spec is:
<ImportExportSpecification Path="F:\ETL\Load\MyResearch\agreements.csv" xmlns="urn:www.microsoft.com/office/access/imexspec">
    <ExportText TextFormat="Delimited" FirstRowHasNames="true" FieldDelimiter="," TextDelimiter="{DoubleQuote}" CodePage="65001" AccessObject="qryOCRC Agreement" ObjectType="Query">

The simple SSIS Data Flow Task has an OLE DB Source to connect to SQL Server database, a Flat File Destination and one Connection Manager.



HomeCookN


Viewing all articles
Browse latest Browse all 24688

Trending Articles