Reputation: 1015
In SSIS... is it possible to access and change the package itself from one of its script tasks? If it is... could you please provide an example?
For instance, I would like to programmatically configure the tasks within a foreach loop from a script task located outside (before) the loop. Something like reading a file and add/removing/configuring tasks depending on its contents.
Thanks for your time!
Upvotes: 1
Views: 190
Reputation:
As @Derek had already mentioned, it is not possible to alter the package itself. However, you can use precedence constraints/Expressions to alter the behavior of Control Flow tasks based on the value present in variable(s), if that is what you meant by altering a package.
Here are few examples where I have used precedence constraints to redirect/restrict the control flow tasks based on an expression:
How to loop through only files that don't exist in destination using an SSIS package?
How can I stop a package execution based on a stored procedure output?
How to avoid SSIS FTP task from failing when there are no files to download? (This example uses a script task followed by a Foreach Loop container.)
How to write an SQL statement output to a CSV file?
Hope that helps.
Upvotes: 2
Reputation: 23238
No, that's not possible - however, I do something very similar by utilizing a second "child" package that I reuse numerous times. In the script you can simply clear out the child package, put all of the items/containers/constraints you need into it, and then execute it.
Upvotes: 1