Create SSIS package to import from one of many data sources

前端 未结 2 662
面向向阳花
面向向阳花 2021-01-24 07:56

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

相关标签:
2条回答
  • 2021-01-24 08:14

    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).

    0 讨论(0)
  • 2021-01-24 08:32

    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.

    control flow

    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.

    precedent constraint editor

    0 讨论(0)
提交回复
热议问题