Load CSV file which delimited by comma
-
Monday, December 10, 2012 1:58 AM
Hi All Expert,
I have one general question, I want to load the data from CSV file which is delimited by comma, it looks like the following:
ID, Name
"1","A"
"2","B"
"3","C,"
You can see that in the third row, there is another comma in Name field, how to overcome those Issue?
Thanks.
All Replies
-
Monday, December 10, 2012 2:00 AMThere is nothing to overcome. You have a comma delimited file with string delimiters. Set the field delimiter to comma and the text qualifier to a double quotes
Chuck Pedretti | Magenic – North Region | magenic.com
- Edited by Chuck Pedretti Monday, December 10, 2012 2:01 AM
-
Monday, December 10, 2012 2:49 AM
Yes, Thanks.
If the text looks like this one:
ID, Name
"1","A"
"2","B"
"3","C""A"
There exists additional doble quotes in the Name, How to parse that one?
Thanks.
-
Monday, December 10, 2012 3:00 AM
It will treat the extra "" as a " inside the string. So the value loaded from the name field would be C"A
Chuck Pedretti | Magenic – North Region | magenic.com
-
Monday, December 10, 2012 3:38 AM
Thanks for your good reply.
So what shall I do for that case, I mean I want to get the final record like
ID, Name
3, C""A
How to achieve that one?
-
Monday, December 10, 2012 6:27 AM
I am not sure if this kind of records are accepted in SSIS.
If so you can use a derived column after reading the data and replace " with "" using this expression:
(DT_STR,10,1252)REPLACE(C2,"\"","\"\"")
Regards,Eshwar.
--Please use Marked as Answer if my post solved your problem and use Vote As Helpful if the post was useful.
-
Monday, December 10, 2012 7:53 AM
Hi,
If the file type is CSV and column value is A,C""A ("A","C""A" ) the flat file component with option column delimiter (,) and text qualifier (") would be reading as A,C""A
Thanks,
Vipin
-
Monday, December 10, 2012 2:20 PM
When you have data that looks like that, then the best bet is to stop using CSV files and use a fixed format file insteadChuck Pedretti | Magenic – North Region | magenic.com
- Marked As Answer by Eileen ZhaoMicrosoft Contingent Staff, Moderator Tuesday, December 18, 2012 6:15 AM

