Quantcast
Channel: Questions in topic: "ssis"
Viewing all articles
Browse latest Browse all 813

Import a file with different number of fields

$
0
0
I have a csv file (example below) with a different column count based on the first value. There are 7 different layouts and the file doesn’t have a header. Based on the first field I can identity which layout the record belongs to. Is there a way I can split the file into 7 different files then import it to the appropriate tables? I know there’s a conditional split feature in SSIS, but the problem I’m having is the source file has different number of fields. Here's a sample of three out of the 7 different types of records that I have in one file: 5,20131017,ACM10,B_xxx@gmail.com,S,5,xxx@gmail.com 5,20131017,ACM10,B_xxx@yahoo.com,R,5,xxx@yahoo.com 15,20131017,_DCR5,xxx@gmail.com,55.228.227.1,m 15,201301017 ,_DCR5,xxx@gmail.com,65.115.221.1,m 7,20130910,_dfpn,xxx4@yahoo.com,S 7,20130915,_dfpn,xxx@gmail.com,S If the first column is 5 then it will have 7 columns, if the first number is 15 then it have 6 columns, and if the first number is 15 then it will be 5 columns.

Viewing all articles
Browse latest Browse all 813

Trending Articles