Hi I have one doubt in SSIS, I want load multiple csv files into SQL server table using SSIS package. while loading time we need consider data from headers on wards.
Source path have 3 csv files with fixed header columns with data but each file have file desciption and dates creation information before headers and one file description comes 2row and headers row start from 4th row with data. Another file description comes from 1 row and 9 row on wards have headers with data and another file will come file description from 5 row and headers row start from 7th row. Columns headers are fixed in the all csv files
Files location :
- C:\test\a.csv
- C:\test\b.csv
- C:\test\c.csv
a.csv file data like below :
here descritpion and dates comes 2and 3 row.actual data start from 4th row onwards
descritiion:empinfromationforhydlocation
creadeddate:2018-04-20
id |name|loc
1 |a |hyd
b.csv file data like below :
here descritpion and dates comes 1and 2 row.actual data start from 9th row onwards
descritiion:empinfromationforhydlocation
creadeddate:2018-04-21
id |name|loc
10 |b |chen
c.csv file data like below :
here descritpion and comes 5 and 6 row.actual data start from 9th row onwards
descritiion:empinfromationforhydlocation
creadeddate:2018-04-21
id |name|loc
20 |c |bang
Based on above 3 file I want load data into target sql server table emp
:
id | Name |Sal
1 |a |hyd
2 |b |chen
3 |c |bang
here I tried like below in the package side:
- create variable :
- filelocationpath: C:\test\
- filename : C:\test\a.csv
- drag and drop the for-each loop container :
- choose the type of enumerator for-each file enumerator
- directory: c:\test
- variable mapping :filename configure it.
- type of file: *.csv
- retrieve filename: filename and extension
- Inside for-each loop container I drag and drop the data-flow task and create flat file connection, here used one of file is configure and header row skipped is 1 and used data conversion required column and configure to OLE DB destination table and create dynamic connection expression for flat-file connection to pass filename dynamically.
After executing the package 2nd file is failed due to description and dates information:
- description and dates is not constantly comes fixed rows next day files
- description and dates will comes with different rows
Is there possible to find dynamical how many row will skip and that count will pass in header row skip.is it possible in SSIS.
Please tell me how to achieve this task in SSIS