Data flow task and double quote escaping
I have a data flow task that I am using to import data from a CSV file using the flat file connection manager to an OEL DB connection. The CSV uses double quotes as a text quantifier.
And I have enabled this option on the flat file connection, and the below example does work
EG
“Some name”
However when there is a double quote in the original text
EG
some” name
Then the string is being escaped as
Eg
"some"" name "
Which I believe is correct and I have tested the escape using VB which also works.
However when using a data flow task I get the following error
[Flat File Source [501]] Error: The column delimiter for column "Name" was not found.
“Name” being the name of the column that holds the value
What is causing the task to fail?
PS I am using SQL server 2005 if that makes a difference
November 2nd, 2010 6:04am
Add some column names to the csv file as: "col1"|"col2"|"col3" or col1|col2|col3 and check the "column name in the first data row" option in flat file connection manager. Following file is working for me:
Name|AGe
"Christiano"" Ronaldo"|"21"
"Messi",20
Nitesh Rai- Please mark the post as answered if it answers your question
Free Windows Admin Tool Kit Click here and download it now
November 2nd, 2010 6:26am
The columns are already named and the import works perfectly for multiple files and millions or records, however when the task comes across a double quote that has been escaped
that it fails. There seems to be no reason for it to fail but it does.
November 2nd, 2010 6:39am
Hi Mike,
I think you configured Text Qualifier in Flat File connection? Please open CSV file in Notepad, for example:
col1
, col2
1,
“Some name”
2,
“some”” name “
If you configured
Text Qualifier “ in Flat File connection, the second row will be split to two columns, then you will see the error message “The column
delimiter for column "COLUNMNAME" was not found.” You can try to remove Text Qualifier and try to clear double in data flow or you can refer to this thread:
http://social.msdn.microsoft.com/Forums/en/sqlintegrationservices/thread/65289e90-2fc3-4865-a582-135fdc6dd2af
Or importing the entire contents into a single column and then split/clear data in
script component:
http://www.bimonkey.com/2009/06/flat-file-source-error-the-column-delimiter-for-column-columnname-was-not-found/
http://www.ideaexcursion.com/2008/11/12/handling-embedded-text-qualifiers/
Hope this helps,
RaymondRaymond Li - MSFT
Free Windows Admin Tool Kit Click here and download it now
November 2nd, 2010 10:30pm
Hi Raymond
I have resolved my problem but do not have a solution to this problem. Someone upstream from me took a shortcut and so changed the single quote to a double quote; I have simply reverted back to the
original text values and the file imports correctly, thanks for your help.
I did us the second method in which I imported the entire line and then split it using TSQL, this was rather heavy on the database engine, but I can see that the script component would have been a
better option
November 3rd, 2010 1:37am