Foreach loop with Multiple Data flow for Different Files
hi..
I have mutiple files in a folder with different names, like
abc-001.txt
abc-002.txt
abc-003.txt
xyz-001.txt
xyz-001.txt
xyz-003.txt
files start with a"abc" processed seperately, meaning goes to table A
files start with "xyz" processed seperately, meaning goes to table X
can I have one foreach loop to process files with different file names, can i execute two different dataflow tasks, based on the file name?
June 20th, 2012 1:49pm
You can have two ForEach Loop containing file mask abc-*.txt and zyz-*.txt respectively each taking care of its own files in a single DFT or notArthur My Blog
Free Windows Admin Tool Kit Click here and download it now
June 20th, 2012 1:55pm
Also can use this component twice: http://microsoft-ssis.blogspot.ca/2012/04/custom-ssis-component-foreach-file.html if you need a good wildcarding support.Arthur My Blog
June 20th, 2012 1:57pm
question: does table X and Table A have the same meta data?
if so you can do this by using one DFTSincerely Nik -- MCITP , MCTS -- Please kindly mark the post(s) that answered your question and/or vote for the post(s).
Free Windows Admin Tool Kit Click here and download it now
June 20th, 2012 2:13pm
table X and table A have different meta data
June 20th, 2012 2:18pm
table X and table A have different meta data
Then there are two options:
1) Create two separate Foreach Loops with there own Data Flow Task.
2) Add a dummy task (sequence container/scripttask) in the Foreach Loop and connect it to two different Data Flow Tasks with a constraint on each Precedence Constraint (the green line). Depending on the filename you can redirect the file to the
correct Data Flow Task.Please mark the post as answered if it answers your question | My SSIS Blog:
http://microsoft-ssis.blogspot.com |
Twitter
Free Windows Admin Tool Kit Click here and download it now
June 20th, 2012 2:28pm
Oh, did not see SSISJoost replied with option #1 here, too. So let me second him.Arthur My Blog
June 20th, 2012 2:34pm
table X and table A have different meta data
Two loops then is the easiest, and two DFTs each loading to its own table and what I also think you can run the DFTs concurrently for the sake of speed!Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
June 20th, 2012 2:34pm
I see that you got your answer
what i would do is, if I see that the number of my packages will grow, i would make a package for each file type, this is more easier to controll and trace.
good luckSincerely Nik -- MCITP , MCTS -- Please kindly mark the post(s) that answered your question and/or vote for the post(s).
June 20th, 2012 2:50pm
thanks folks, i will go with two different foreach loop.
Free Windows Admin Tool Kit Click here and download it now
June 20th, 2012 2:50pm