How to use use if..else in Data Flow based on user variable values in SSIS

14,643

I guess there are enough pointers here for Agent 007 to resolve the issue. I would like to add a few general comments.

  1. Enabling/disabling the tasks dynamically is not a good practice. A better way to disable a task is to use an expression within a precedence constraint. One such reference: http://www.sqlis.com/sqlis/post/Disabling-tasks-Through-Expressions.aspx

  2. As suggested convert each STD (Source-Transform-Destination) into its own DFT. Even better use parent-child pattern. This would help in testing future additions of more DFTs.

Share:
14,643
Agent007
Author by

Agent007

public class Me : Lazy<Person> { public void DoWork() { throw new NotImplementedException(); } }

Updated on June 14, 2022

Comments

  • Agent007
    Agent007 almost 2 years

    I have a fairly straightforward SSIS package with a number of Data Flow tasks each with data-flows for multiple tables like shown below: enter image description here

    I want to be able to execute each of these data-flows based on some user-defined variable values that I manipulate using a Script Task in control-flow. Something like, if a variable (say BESTELLDRUCK) value is true, then I want to execute the data-flow for this table (source-conversion-destination tasks), else I want to skip this table and proceed to another table (e.g. AKT_FEHLER) in same data-flow task.

    How can I do this? Thanks in advance.

  • Peter PitLock
    Peter PitLock about 8 years
    Once you've split each into its own DFT, is it possible to execute a specific DFT via SQL Command? on the IDE it is easy, just right click the DFT and execute
  • Anoop Verma
    Anoop Verma about 8 years
    If you want to run the DFT via a SQL command, I would suggest that you put each DFT in a child package of its own.