SSIS Exclude certain files in Foreach Loop Container

血红的双手。 提交于 2019-12-06 06:20:18

问题


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.

Currently, the FileSpec of the container looks for all files with the following format:

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_*

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.

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_*


回答1:


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

Where @var is the loop iterable.

Only files without "business" inside will proceed to the next step. Hope this is what you wanted.



来源:https://stackoverflow.com/questions/19093008/ssis-exclude-certain-files-in-foreach-loop-container

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