SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


import flat file through SSIS


import flat file through SSIS

Author
Message
sophli
sophli
SSC Rookie
SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)

Group: General Forum Members
Points: 36 Visits: 16
I have a SSIS package which imports a flat file to DB. The file delimiter is Comma, the text qualifier is set to " (double quote). It was all fine until it hits this column: "toys ""r"" us, inc." supposedly the comma is inside of the text qualifier, but I guess the double double quotes around the R confused the system, so the field was splited into two. And this causes problem. I was wondering if anybody have any idea how to handle this (modify the original import file is not an option.)
Thanks!
jacob sebastian
jacob sebastian
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3426 Visits: 2523
I tried with a file having the folllowing content.

"Jacob","jacob"s" File", "Other File"

I get this file processed correctly (Jacob, Jacob"s" File, Other File) with the following settings (SSIS Flat File Connection manager)

format: delimited
Text Qualifier: "
Column delimiter: comma {,}
Row delimiter: {CR}{LF}

.
sophli
sophli
SSC Rookie
SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)

Group: General Forum Members
Points: 36 Visits: 16
Thanks for your quick response. I guess I didn't state the problem clearly. In my case, I don't want the data imported as two seperated fields: "toys ""r"" us" and "inc". the whole thing should be one field (column).
jacob sebastian
jacob sebastian
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3426 Visits: 2523
ah! my mistake.

.
Robert O'Byrne
Robert O'Byrne
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1034 Visits: 323
I don't have a solution, but shouldn't it be "toys 'r us" with a single quote before the r? Maybe the data can be corrected before you receive it?
'nix
'nix
Valued Member
Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)

Group: General Forum Members
Points: 62 Visits: 69
...or find any instances of double qoutes in your text file and replace with single qoutes before executing the import.

Does anyone ever get really 'Clean' data?

'nix
sophli
sophli
SSC Rookie
SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)

Group: General Forum Members
Points: 36 Visits: 16
Thanks for all the inputs! Yea, I am working on reformatting the data. I was hoping that I don't have to do that...
alen teplitsky
alen teplitsky
SSCrazy Eights
SSCrazy Eights (9.2K reputation)SSCrazy Eights (9.2K reputation)SSCrazy Eights (9.2K reputation)SSCrazy Eights (9.2K reputation)SSCrazy Eights (9.2K reputation)SSCrazy Eights (9.2K reputation)SSCrazy Eights (9.2K reputation)SSCrazy Eights (9.2K reputation)

Group: General Forum Members
Points: 9168 Visits: 4674
i do monthly imports of taxation data from CCH and have had a similar problem

only solution i ever found was to map out the column lengths
sophli
sophli
SSC Rookie
SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)

Group: General Forum Members
Points: 36 Visits: 16
By "map out the column lengths" do you mean make it a fixed length file?
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (277K reputation)SSC Guru (277K reputation)SSC Guru (277K reputation)SSC Guru (277K reputation)SSC Guru (277K reputation)SSC Guru (277K reputation)SSC Guru (277K reputation)SSC Guru (277K reputation)

Group: General Forum Members
Points: 277072 Visits: 42236
If you setup a BCP format file correctly and use Bulk Insert, that problem will magically disappear... performance problems will probably disappear, as well. I've used Bulk Insert with a format file to import more than 5 million rows per minute on a 20 column quoted identifier CSV.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search