Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SSIS: Flat File Data Source: Text qualifier (") blows up for lines with internal two double quotes

Posted on 2011-03-23
3
Medium Priority
?
1,053 Views
Last Modified: 2012-05-11
I'm trying to import a .csv file whose author chose this quoting system: two double quotes are used internally to quote an item inside a field.  Example input file:
"Song Name", "Composer"
"Yellow Submarine","Beatles"
"Symphony no 94 ""Surprise""","Haydn"     <--- SSIS doesn't like ""Surprise""
I have these set:
    Format: Delimited
    Text qualifier: "

All rows import except the lines that look ""like this""

How can I get around this problem without writing C# to manually clean up those lines before I import using SSIS?

SQL Server is an enterprise-level data solution... there must be a built-in way to attack this problem.
0
Comment
Question by:ZuZuPetals
  • 2
3 Comments
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 35200668
Add a Derived Column Transformation task
Set up 2 variables one to store "" the other to store ''
in the expression of Derived column do a REPLACE function something like this
REPLACE( [yourfield], @[User::q1], @[User::q2])

so as to replace 2 double quotes with 2 single quotes -
0
 
LVL 2

Author Comment

by:ZuZuPetals
ID: 35203192
Do you do that stuff before or after (or inside?) the "Flat File Source" component?
Thanks, but could you please provide more detail?
0
 
LVL 17

Accepted Solution

by:
Barry Cunney earned 2000 total points
ID: 35205481
Hi ZuZuPetals,
You do that stuff in separate step between your flat file source and your destinatation
Derived Column is one of the Transformation Tasks in the Toolbox

Please see print screen with example


SSISDerivedColumn.jpg
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question