Conditional split is used to route data rows to different outputs based on conditions. This is similar to CASE statement in programming languages.
Here I am explaining conditional split with an example.
Requirement is to route country specific data from a SQL Server tables to different flat files.
Drag and drop a data flow task to the package under Control Flow.
Double click on the dataflow task and define the flow of data.
Create source DB connection and destination flat file connections under connection managers. Drag and drop and OLE DB Source to select the source table data. Double click on the source and I have selected the data using Sql Command data access mode.
Transformations will vary based on the data to be populated to the destination. Here I have added a Derived Column to handle null values in the middle Name.
Drag and drop a Conditional Split tool from the tool box
Double click on the Conditional Split , transformation editor pop up will be shown. Here we can define the different conditions and routing will be done based on the condition we define here.
So there are 3 routes defined in the above screen each condition will redirect the rows to 3 different routes and rest of the rows will be routed to the fourth route.
Create flat file destinations for each routes.
For each destinations, select corresponding connection manager that we have already created.
There will be four outputs from the Conditional Split. Drag and drop each outputs in to correspond destinations. There will be option to choose the out put.
Finally the Data Flow will look like this:
Execute the package and the files will be created in the file location created in the locations configured under the connection managers.
Thank you for reading the article.