views:

33

answers:

2

I need to pull data from csv file to SQL Server table. Which Control task should I use ? Is it Flat File ? What is the correct method to pull data ?

The problem is I have used Flat File Task for pulling csv file. But the csv file whihc I am having, contains headings as first row, then on the third row, I have the columns, and data starting from fifth row.

Another problem is, in this file column details comes again after 1000 data ie columns appears in two rows. Is it possible to pull data ? If so, HOW ?

+1  A: 

I believe you'll first have to transform your file into a proper CSV file so that the SSIS Flat File Source component (Data Flow) can read it. If the source system cannot produce a real CSV file, we usually create custom .NET applications for the cleanup/conversion task. An Execute Process task (Control Flow) that executes the custom app can then be called prior to the Data Flow.

Valentino Vranken
ok. How about Script task ?
Sreejesh Kumar
Well, sure, that should also be possible. After all, you can use the whole .NET framework in a script task so file manipulation is not an issue.
Valentino Vranken
+2  A: 

While Valentino's suggestion should work, I suggest that first you work with the provider of the file to get them to provide the data in a better format. When we get stuff like this we almost always push it back and ask for properly formatted data. We get it too about 90% of the time. It will save you work if they will fix their own drek. In our case, the customers providing the data are paying for our programming services and when they understand how substantial an increase in the cost to them, they are usually nmore than willing to accomodate our needs.

HLGEM
You've got a good point there! I automatically assumed that this wasn't an option, but that's indeed always the first approach to take! +1 for you :-)Unfortunately I've seen several cases where this wasn't an option though... Ah well, keeps us busy doesn't it?
Valentino Vranken
I know. The csv file format which I got from the client was not a correct one. SSIS cant automatically handle these issues, unless a correct format is provided.
Sreejesh Kumar

related questions