Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Simple way to load "almost" identical files SSIS

Author  Topic 

sql_er
Constraint Violating Yak Guru

267 Posts

Posted - 2011-12-07 : 22:53:15
Hi guys,

I have the following problem that I need help on:

I am given a set of CSV files which I need to load through SSIS into the database table. The files are comma delimited with double quotes as a text qualifier and have an almost identical structure with the following difference - some of the files have a comma at the end of each row while other files do not have the comma at the end of each row.

Example:

First set of CSV Files have the following structure:

"abc", "def", "ghi",
"jkl", "mnop", "qrst",

Second set of CSV Files have the following structure:

"abc", "def", "ghi"
"jkl", "mnop", "qrst"

I want to have all of the files together in 1 folder and process them together.

What is the easiest way to do this?

Would I need to perform some preprocessing using some script task, or is there a simpler way to deal with these "almost" identical csv file structures, and process them together?

Please advise.

Thank you!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-08 : 00:35:14
add a dummy field towards end to take care of files with , at end. then in final mapping to oledb destination ignore this column altogether so it doesnt get added up to table

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -