Importing CSV files with variable rows
I am trying to import csv files into SQL server. The first row in the file contains identifier information (Id, Company, Date, File Type). The second row contains the column headers. The remaining rows contain the column data. What I need to do is read the first row to determine the File Type and then build a table using the column headers and column data. When I use SSIS and try to import the rows I end up with 4 columns which is correct for the identifier row but combines many of the column headers and column data entries as comma seperated values in column 4. Any help would be greatly appreciated. Thanks, Bob
February 22nd, 2012 3:49pm

Hi Bob, use the Conditinal Split Transformation to generate a set of three flat files and operate on each to process according to the logic. A close example could be this post: http://www.sqlis.com/sqlis/post/Handling-different-row-types-in-the-same-file.aspxArthur My Blog
Free Windows Admin Tool Kit Click here and download it now
February 22nd, 2012 5:39pm

Do you have a finite set of expected file formats? Talk to me now on
February 22nd, 2012 6:06pm

Hi Bob, use the Conditinal Split Transformation to generate a set of three flat files and operate on each to process according to the logic. A close example could be this post: http://www.sqlis.com/sqlis/post/Handling-different-row-types-in-the-same-file.aspxArthur My Blog
Free Windows Admin Tool Kit Click here and download it now
February 23rd, 2012 1:30am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics