views:

28

answers:

2

Goal: I have a Db source. Depending on a variable, i need to store it into a fixed width file OR a delimited file.

How do I do this in a data flow? I tried creating a conditional split, with two conditions. One condition going to a fixed width destination, and one to a delimited condition. Problem is that conditional split executed BOTH conditions even if no data comes in one condition. Becuase filename is same, so it errors out.

A: 

Use two different data flows and do the diversion from with in the control flow. If you want to do it within the data-flow itself I guess you will have to use different filenames.

Faiz
Yeah, doing it from control flow is how we have done it at the moment as this seems to be the only way out. The thing is that the dataflow has a good amount of logic... and just for the sake of a conditional destination, i will need to duplicate the full dataflow! Bad architecture I would say. But unfortunately, due to SSIS limitations, this seems to be the only way out.
Saurabh Kumar
I won't call it bad architecture as it will not hamper the performance anyway. But it will be a maintenance head ache for sure.
Faiz
A: 

I would keep your solution with the folowing tweeks.

Write out to two Filename-fixed.txt and filename-delim.txt. Before those steps add row count tasks. alt text

Then in your control flow you have two Success paths. Edit the success paths to look for both success and expression. Add an expression that checks the count from the new row count tasks in your dataflow. If you have file system tasks as your end point have them rename your fixed or delim file to the correct file name.

alt text alt text

Note: I didn't try this and the pics all have red x's because I find it helpful to have the picture to figure out the logic not because I actually coded the solution.

CTKeane
Good idea. Will try this out. Thanks for thinking it out!
Saurabh Kumar