Is it possible to create an SSIS package that can be passed a file (through a variable) and from the variable determine which Data Flow Task to use?
What I would like to
I did something similar with a for each loop in the control flow. It went through all the files in the processing directory and directed them to the correct dataflow based on the name of the file (since they were all the same file type but with different internal structures).
As HLGEM has indicated, as long as the internal structure was consistent, something like this would suffice.
I'd declared a package level variable, DatFlowSelector
and within my initial script task, I'd use logic to determine what path the flow should take based on the FileName
variable you were going to use.
After wiring up the expected outputs, use the Precedence Constraint editor to determine what path evaluates to true. My logic was simply @[User::DataFlowSelector] == N
where N maps to the value my script assigned.
I generally switch the ShowAnnotation
property to "ConstraintOptions" when I modify the constraints as it makes it immediately clear to future maintainers that there is something going on. SQL 2012 will help in this case as it assigns the fx
glyph to the connector but displaying the logic can provide at-a-glance confirmation of sound logic.