November 28, 2012 at 11:47 am
Hi all,
I have an SSIS package that downloads csv files. The first process queries a db table (Execute SQL Task) to see which type of download needs to be performed. For example, my db has 3 particular tables ie: tblCPISC, tblGDPSC, & tblPopulationSC. If I run this package right now, it is set to load the tblCPISC based on a table number from within (3260020). 3 days from now, the first process will load tblPopulationSC with a table number = 3790027. Once the download number (3260020 or 3790027) is placed into a package variable the next process, which is a Foreach Loop Container, starts with a Script task that downloads the csv file which is zipped. Next is an Execute Process Task which unpacks the zipped file. Next is another script task that deletes the downloaded zip file. What I want to do after (and before the data flow task) is look at the variable and load the csv file into the right table via data flow task. I thought that having 3 different data flow tasks, one for each table would be the right way of doing this but I'm not sure about how to direct this properly from the script task to the right data flow task. In my script task I have Dim tn As String = Dts.Variables("User::Table_Number").Value
Select Case tn
Case "3260020"
Case "2820001"
Case "3790027"
End SelectHowever, I don't know how or what code I should be using for directing to the right data flow task!?! The 3 names I have for the data flow tasks are: 1) Data Flow Task for CPI; 2)Data Flow Task for Population; and 3) Data Flow Task for GDP
Can someone point me straight here?
Regards:
Mordred
Keep on Coding in the Free World
November 28, 2012 at 12:23 pm
You're on the right track but you missed a small detail that would make your life a lot easier. It's in the precedence constraint (the green lines you drag around).
Double click on the lines going into your three dataflows. You'll need to do each one independently. It'll open up the Precendence Constraint Editor.
You'll want to start with changing Evaluation Operation to Expression and Constraint. Leave Value as Success. In Expression, you want @User::<Varname> == "whatever". At the bottom you want to leave it with Logical AND.
Using this you can control exactly which paths will activate based on your Variable values.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
November 29, 2012 at 9:39 am
Hi Evil,
Thank you very much for that. I actually went into the precedence constraints before posting here but I didn't know what to do there. Now I know and thanks again!
Regards:
Mordred
Keep on Coding in the Free World
November 29, 2012 at 9:54 am
Thanks so much as this worked quite well. The expression didn't like User:: so I went with @Table_Number=="3790027" which was accepted.
Regards:
Mordred
Keep on Coding in the Free World
November 29, 2012 at 11:39 am
Mordred (11/29/2012)
Thanks so much as this worked quite well. The expression didn't like User:: so I went with @Table_Number=="3790027" which was accepted.
My pleasure. Sorry, some require the User:: some don't, I forget which and when, I use the dropdowns to remind me. 🙂 Glad it worked out.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply