处理具有不同结构的文件 For each Loop SSIS [英] Handling files with different structure For each Loop SSIS
问题描述
一个目录中有 3 个文件,其中两个具有相同的结构,第三个在文件末尾多出 3 列.
There are 3 files in a directory and two of them are with same structure and the 3rd one has 3 more extra column in the end of the file.
file 1: columna,....,columnz
file 2: columna,....,columnz
file 3: columna,....,columnz,Column1,Column2,column3
是否可以使用单个连接导入所有这些文件? for each 循环容器?如果平面文件连接是基于文件 3 .
Is it possible to import all these files using a single connection with in a for each loop container? If the flat file connection connection is based on the file 3 .
推荐答案
不,这在 SSIS 中是不可能的.使用专为文件 3 设计的平面文件连接将损坏从文件 1 和文件 1 加载的数据.2.
No this is not possible in SSIS. Using a Flat File Connection designed for file 3 will corrupt data loaded from files 1 & 2.
我将为不同的布局构建 2 个平面文件连接,然后在 For Each Loop Container 中,我将为两个布局构建 2 个数据流任务.我将使用表达式禁用数据流任务,以便仅对每个文件执行适当的数据流任务.
I would build 2 Flat File Connections for the different layouts, then within the For Each Loop Container I would build 2 Data Flow Tasks for the two layouts. I would disable the Data Flow Tasks using an Expression, so that only the appropriate Data Flow Task executes against each file.
这篇关于处理具有不同结构的文件 For each Loop SSIS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!