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 be able to do is to create a single DTSX package that can take in a filename as a variable and detect (simply from the filename) if it is an Excel 2003, Excel 2007 or CSV file and from that, execute the correct Data Flow Task. I will then process the results in another single Data Flow Task after the data has been imported.
I used SSIS a long time ago and I am just coming back to using it so my knowledge is locked away and will come back slowly. I just can’t seem to remember (or find on Google) a way of creating a conditional split in the Control Flow.
Any ideas?
As HLGEM has indicated, as long as the internal structure was consistent, something like this would suffice.
I’d declared a package level variable,
DatFlowSelectorand within my initial script task, I’d use logic to determine what path the flow should take based on theFileNamevariable 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] == Nwhere N maps to the value my script assigned.I generally switch the
ShowAnnotationproperty 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 thefxglyph to the connector but displaying the logic can provide at-a-glance confirmation of sound logic.