SSIS 序列容器:设置文件不存在时的条件参数 [英] SSIS sequence container: Setting conditional parameters for when file is not present

查看:25
本文介绍了SSIS 序列容器:设置文件不存在时的条件参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人可以就我在 SSIS 序列容器中遇到的问题提供另外一些观点.我对序列容器比较陌生,它们正在完成需要完成的工作,但情况是这样的:假设我有三个序列容器,它们都处理文件.容器 A、B 和 C.容器 A 将始终处理,因为它解压缩文件,但容器 B 可能不会根据文件是否存在执行操作,与容器 C 相同.所有容器都包含其他工作正常的任务.我已经尝试通过使用表达式评估文件名来使用容器之间的约束,但这似乎不起作用.我不确定答案是否是在序列容器中的数据流任务中放置一个脚本任务以查看文件名,然后说,如果文件存在,则对其进行处理,如果不存在,则继续.

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.

推荐答案

如果我理解你的问题.序列容器 A 始终运行,因为它正在寻找下游容器所依赖的 .zip 文件.如果父项不满足某些条件(找到要解压缩的档案),则希望禁用相关项.

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

最快/无代码的方法是将两个序列容器包装在一个 Foreach 循环容器中.那会触发,找不到要处理的文件并且永远不会调用内部容器.

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.

根据下面的评论,我可能会这样设计我的包.Sequence 容器封装了数据可用时需要发生的所有事情.序列容器是我的文件是否在那里的简单检查.这确实假设简单的文件存在检查就足够了.如果需要文件 A 和 Z,那么脚本任务会更容易.

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.

ForEach 循环容器的配置.我通常使用枚举器部分下的表达式(并根据变量而不是显示的硬编码值进行分配),因为这给了我最大的灵活性.

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.

这篇关于SSIS 序列容器:设置文件不存在时的条件参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆