Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

how to skip dynamic header rows in ssis

$
0
0
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 description and dates creation information before headers and
one file description comes 2row and headers row start from 4th row with data.
another file descriptions 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 7throw
columns headers are fixed in the all  csv files



Files location : 1)C:\test\a.csv 2)C:\test\b.csv 3)C:\test\c.csv
a.csv file data like below :here description 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 description and dates comes 1and 2 row.actual data start from 9th row onwards
description:empinfromation for hyd location
createddate: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 : 1)filelocationpath: C:\test\  2)filename : C:\test\a.csv
drag and drop the foreachloop contaier :choose the type of enumerator foreachfile enumeratior
directory: c:test\
variable mappting :filename configue it.
type of file: *.csv 
reterivefilename: filename and extension
inside foreachloop container I drag and drop the dataflow task
and create flat file connection here used one of file is configure and header row skiped is 1
and used data converion required column and configure to oledb destionation  table
and create dynamic connection expression for flatfileconnection to pass filename dynamically.

after execute the package 2nd file is failed due to descrition and dates inforamtion
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 dynamicaly 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 

Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>