Thursday, March 8, 2012

"loop" a package in script task?

In Dts you can loop a package by creating an Active-X script with something like this ...
"oPackage.Steps("DTSStep_1").ExecutionStatus = DTSStepExecStat_Waiting"
"oPackage.Steps("DTSStep_2").ExecutionStatus = DTSStepScriptResult_DontExecuteTask"

What is the way to do in SSIS? Depending on a condition i want to rerun my package but have not found a smooth way to do it. I guess you can do it in a better way than using the ActiveX Script Task

have a nice day
/Erik

I think the For loop container can help on that (you can place a Execution package task inside to call another package).

http://msdn2.microsoft.com/en-us/library/ms139956.aspx

I know there is a lot of info in the web, so do a litle research and post back if you need more help.

|||

Well, the thing is that I use a foreach loop for all rows in a table.. but when all rows are processed there might be a row that have been inserted during the process of the rows that existed at the time the package started..
So after my foreach container i want to to check if there are new rows to process before ending the package... if there are any, I want to start trigger the first task in my package....

|||

I still see this doable. My suggestion was to create an additional package that acts as parent package; it would have a for loop (different than a foreach loop) with an execution package task inside. The For Loop container would have evaluation expression that is modified by the child package in case one of those special rows is inserted. The child package needs to know when a row of the type that requires a new iteration is inserted; so it can change the evaluation expression of the parent package to make it to continue.

This is just an idea; I have not done something simila before.

|||

OK, I understand what you mean.. I′ll check it out, cheers for the help!

No comments:

Post a Comment