Pages

Thursday, October 27, 2011

How to implement Conditional Split in Control Flow of SSIS










As we don't have a conditional split in control flow of SSIS. We need to follow below steps to achieve Conditional split in Control Flow.
1. Define a Package Variable (i.e. UserName).
2. Add a dummy script task and set the TaskResult property to success.As shown in Figure 1 & Code.














Figure 1: SSIS Package with Dummy Script Task


public void Main()
        {
            Dts.TaskResult = (int)ScriptResults.Success;
        }


2. After that define a precedence constraint between script task and data flow task. Precedence constraints link the individual executables together and determine how the workflow moves from one executable to the next.

3. Add an expression, double-click the precedence constraint to open the Precedence Constraint Editor dialog box, as shown in Figure 2. (The editor shown in this figure is the one for the precedence constraint that connects the first and second Execute SQL tasks.)

























4. Data will flow on the basis of Package Variable value. As shown in Figure-3





6 comments:

Anonymous said...

This is awesome It's exactly what I need. Thank you so much!

Ned said...

Just wanted to let you know who left the last comment.

Ned

Anonymous said...

Awesome. Thanks!

Anonymous said...

thank u

Anonymous said...

This solved my problem.

KeshavR(Mumbai, IND)

Anonymous said...

Great to the point issue and resolution description. Exactly what I needed. thank you sir