How to have a specific Dataflow execute based on file name.

sam nick 286 Reputation points

I have a requirement that needs to be executed in the below steps.

In a folder there are multiple txt files with names as

1) Take 1 file to a temp location
2) Change filename to csv
3) If File name starts with ABC then execute Dataflow1 . If it starts with DEF then execute Dataflow2
4) Continue the process till all files are processed.

I am able to accomplish task 1 and 2 via batch script, but not sure on how to accomplish 3 and 4. Please can you advise. Currently I am doing this manually by clicking the DF manually.

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,464 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Yitzhak Khabinsky 25,201 Reputation points

    Hi @sam nick ,

    Here is how you need to compose steps of the process in SSIS:

    1. 'Foreach Loop' Task, to traverse directory with files.
      Assign a fully qualified file path to a variable.
    2. 'File System' Task, Rename file operation.
    3. Use two precedence constraints to check for 'ABC' or 'DEF' pointing to a particular DFT.

    Check it out here: execute-data-flow-task-based-on-condition-in-ssis

    0 comments No comments

  2. ZoeHui-MSFT 33,386 Reputation points

    Hi @sam nick ,

    This kind of orchestration is easily achieved by using the precedence constraints:

    Reference: precedence-constraints


    Zoe Hui

    If the answer is helpful, please click "Accept Answer" and upvote it.