Thursday, March 23, 2006

SQL Server Integration Services : Conditional Execution of First Task

Based on the Question @ http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=312012&SiteID=1 on conditional execution of task - here is a sample solution.

As suggested by Darren - I have used a sequence container as the first task in the package to place the precedence condition. There are 2 script tasks - based on the value assigned to the boolean variable - 'canProceed' either script task 1 & 2 or script task 2 would get executed.

If 'canProceed' = 'True' : Script Task 1 and Script Task 2 will get executed. If 'canProceed' = 'False' : Only Script Task 2 will get executed.

On the Precedence Constraint editor between the Sequence Container and the first Script Task - "Evaluation Operation" is set to "Expression" and Expression is set to @canProceed.

On the Precedence Constraint editor between the Sequence Container and the second Script Task - "Evaluation Operation" is set to "Expression", Expression is set to !@canProceed

On the Precedence Constraint editor between the first Script Task and Second Script Task - "Evaluation Operation" is set to "Constraint" and Value is set to "Success".

The sample solution package would look similar to the following screenshot.

Hope this should help to solve the Conditional Execution of First task problem.

0 Comments:

Post a Comment

<< Home