SSIS sequence container: Setting conditional parameters for when file is not present

隐身守侯 提交于 2021-02-08 08:50:14

问题


I'm hoping someone can offer another couple of points of view on an issue I am having with SSIS sequence containers. I am relatively new to sequence containers and they are accomplishing what need to be done, but here's the situation: Let's suppose I have three sequence containers and they all process files. Containers A, B, and C. Container A will always process because it unzips files, but container B may not perform actions based on whether or not a file exists and the same with container C. All containers contain other tasks which work fine. I have tried using constraints between the containers by evaluating the file name as such using expressions, but that doesn't seem to work. I'm not sure if the answer is to put a script task inside the dataflow task in the sequence container to look at the file name and then say, if the file is present, process it and if not, move on.

Any help would be appreciated. Thanks so much.


回答1:


If I understand your problem. Sequence Container A always runs because it is looking for .zip files which downstream containers are dependent upon. The desire is to disable the dependent items if the parent didn't satisfy some criteria (found archives to unzip).

The quickest/codefree way would be to wrap the two Sequence Containers inside a Foreach Loop Container. That would fire off, find no file to process and never invoke the inner containers.

A script task, which is a control flow element, is fine and dandy and you can either enable/disable the containers or enable/disable the precedence constraint.

Either one can be the right approach, depending on your business needs.

Based on the comments below, I would probably pattern my package as this. The Sequence container encapsulates all the things that need to happen if data is available. The Sequence Container is the easy check that my file is there. This does assume a simple file existence check is sufficient. If files A and Z were required, then a Script Task will be easier.

enter image description here

Configuration of a ForEach Loop Container. I generally use the Expressions under the Enumerator section (and assign based on Variables instead of the hardcoded values displayed) as this allows me the greatest flexibility.

enter image description here



来源:https://stackoverflow.com/questions/20057482/ssis-sequence-container-setting-conditional-parameters-for-when-file-is-not-pre

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!