应用SSIS 2008复制与XML配置文件中名称相似的变量相关联的文件 [英] Apply SSIS 2008 to copy files associated with similarly named variables in an XML config file

查看:99
本文介绍了应用SSIS 2008复制与XML配置文件中名称相似的变量相关联的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我目前在SSIS下创建了一个名为ProjectFiles.dtsConfig的XML配置文件,其中包含五个变量SrcFile1,SrcFile2,SrcFile3,SrcFile4和SrcFile5.每个文件都有一个定义唯一文件的位置和名称的值,其中每个文件可以位于不同的位置.随着时间的流逝,我将在配置文件中添加和删除文件变量,但是要复制的文件的变量名将始终以"SrcFile"开头.

有没有一种方法可以使用表达式或脚本或其他方法动态循环遍历并复制与以"SrcFile"开头的模式文件中的变量相关联的文件?我已经研究过在SSIS包的Foreach循环容器下应用不同的枚举,并希望避免对变量名(SrcFile1,SrcFile2等)进行硬编码,因为将来可能最终会存在SrcFile6,SrcFile7等.

谢谢,
Kosh2010

Hello,
I currently have an XML configuration file called ProjectFiles.dtsConfig created under SSIS that contains five variables SrcFile1, SrcFile2, SrcFile3, SrcFile4 and SrcFile5. Each has a value defining the location and name of a unique file, where each can be in a different location. Over time I will be adding and removing the file variables from the config file, but the variable names for the files to be copied will always begin with "SrcFile".

Is there a way, using expressions or scripting or whatever, to dynamically loop through and copy the files associated with variables in the schema file that begin with "SrcFile"? I have looked into applying different enumerations under the Foreach Loop Container in an SSIS package and would like to avoid hardcoding the variable names (SrcFile1, SrcFile2, etc.), as there may eventually exist a SrcFile6, SrcFile7 and so forth in the future.

Thanks,
Kosh2010

推荐答案

我已决定针对此问题的目的更改我的方法.目的是遍历在其他文件列表中定义的文件的特定列表,并将它们从不同位置复制到单个位置.我决定不使用XML配置文件中的变量来定义文件路径,而是决定在新的数据库表中定义文件路径,在该数据库表中使用Excecute SQL Task捕获文件列表然后传递该结果更加容易到Foreach循环容器中,该容器将应用文件系统任务,即使用传递的文件枚举器复制每个文件.使用这种方法的维护也更加简单.这种方法解决了该问题,并且易于设置.

在定义的原始方法中使用XML配置文件是不切实际的.

谢谢,
Kosh2010
I have decided to change my approach with regard to the objective of this issue. The objective is to iterate through a specific list of files defined in a list of other files and copy them from different locations to a single location. Instead of defining the file paths using variables in an XML configuration file, I''ve decided to define the file paths in a new database table where it is much easier to capture the list of files using an Excecute SQL Task and then passing that result on to a Foreach Loop container that will apply a file system task of copying each file using the passed file enumerator. Maintenance with this approach is also simpler. This approach resolved the issue and was easy to set up.

Using an XML configuration file in the original approach defined is not practical.

Thanks,
Kosh2010


这篇关于应用SSIS 2008复制与XML配置文件中名称相似的变量相关联的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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