question

redder avatar image
redder asked

Execute SQL Task based on condition in SSIS

I found this online but it doesn't give much detail on this. Can someone give me a step by step scenario? The easiest way that I have found doesn't involve expression on the data connectors between the control flow objects but rather using expressions on the control object itself and setting the "Disable" value using an expression. This way on execution, the object is either skipped or not based upon the expression evaluation. As an example, I wanted to execute a "Execute SQL Task" to run a task based upon whether a variable named "MatchKey" was equal to "CouponCode". If it was then I wanted to kick off a process in SSIS. Thanks!
ssis
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
redder avatar image
redder answered
I figured this one out. I added a "dummy" SQL script to my package and set the Expression and Constraint option on the data connectors or arrow based on the value entered in the MyVar variable that I set up. If a 0 is entered into this variable, it will run one process and if 1 is entered into this variable, it will run another process. Thanks!
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

+1 Yeah, you found it yourselves. You need to set expression for the Disable property as yo have described. 0 means Disabled = false and 1 means Disabled = true.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.