SSIS排除Foreach循环容器中的某些文件 [英] SSIS Exclude certain files in Foreach Loop Container
问题描述
我有一个SSIS软件包,可以使用表达式和通配符从特定目录加载csv文件,以提取所有文件.
I have a SSIS package that loads csv files from a particular directory, using an expression and a wildcard for picking up all the files.
当前,容器的FileSpec
查找具有以下格式的所有文件:
Currently, the FileSpec
of the container looks for all files with the following format:
fileName_environment _ *
fileName_environment_*
,并且工作正常.现在从同一目录中加载第二组文件,为了区别这些文件,文件格式为:
and this is working fine. A second set of files are now bing loaded from the same directory, and to distinguish these, the file format is:
fileName_environment_business _ *
fileName_environment_business_*
因此,第二个SSIS包仅拾取新文件,因为文件的结构如下所示:
So, the second SSIS package picks up only the new files since the structure of the files will look like:
filename_environment_abc
filename_environment_def
filename_environment_xyz
filename_environment_business_abc
filename_environment_business_def
filename_environment_business_xyz
但是第一个包将处理所有文件.
but the first package will process all files.
所以,问题是,我可以设置第一个SSIS包的FileSpec
来忽略以下格式的文件吗?
So, the question is, can I set the FileSpec
of the first SSIS package to ignore the files which are in the format:
fileName_environment_business _ *
fileName_environment_business_*
推荐答案
在foreach循环容器中,将虚拟Script task
放在您已经获得的第一个块之前.用一条线连接这两个,并将Constraint Options
设置为expression,在其中应定义一个FINDSTRING
函数:
In the foreach loop container put a dummy Script task
before the first block you've got already. Connect those two with a line and set Constraint Options
to expression, in which you should define a FINDSTRING
function:
FINDSTRING(@var, "business", 1) == 0
@var是可迭代的循环.
Where @var is the loop iterable.
仅内部没有业务"的文件将继续进行下一步.希望这就是您想要的.
Only files without "business" inside will proceed to the next step. Hope this is what you wanted.
这篇关于SSIS排除Foreach循环容器中的某些文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!