用于数据流任务的Foreach循环容器 [英] Foreach Loop Container For Data Flow Task

查看:95
本文介绍了用于数据流任务的Foreach循环容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从oracle DB导入近1200万条记录,但是由于SSIS内存缓冲区问题,我需要每年(即2005年至2012年)(7次)重复执行数据流任务".我该如何使用foreach我的Oracle查询来逐年获取数据.

I want to import nearly 12 million records from oracle DB but beacuse of the SSIS memory buffer problem i need to iterate my Data Flow Task for each year i.e 2005 to 2012 (7 times). How can i use foreach my oracle query to fetch the data year wise.

查询

SELECT * FROM EMP_RECORDS_DETAILS WHERE to_char(JOIN_DT,'YYYY')=2005

推荐答案

我已经使用Sql Server解决了上述问题.因此,您唯一需要更改的就是选择查询

I have solved the above problem using Sql Server . So only thing which you need to change is the Select query

  1. 首先创建一个变量以存储每年的日期.

  1. First Create a variable to store the date for each year .

 Name: TimeValue  DataType=Int32

  • 使用ForEach循环并在收集"选项卡中选择"Foreach项"枚举器

  • Use a ForEach Loop and select Foreach Item enumerator in the collection tab

    1. 单击列"选项卡,并创建一个数据类型为int的新列

    1. Click on the Columns tab and create a new column of datatype int

    在变量映射图中,上面创建的变量.

    In the variable mapping map the variable created above .

    1. 在数据流内部使用oledb目标,并在数据访问模式下选择sql命令.应该更改where子句中的查询,并尝试选择列而不是提供*.

    1. 单击参数"标签,以映射为foreach循环创建的参数

    如果date的值之前未知,则可以在foreach循环之前使用execute sql任务,并从表中仅选择dateTime列值并将其存储在变量中,然后在foreach循环中使用来自变量枚举器的Foreach在集合选项卡中,选择在上面的执行sql任务中创建的变量.

    In case if the values of date are not known before then you can use execute sql task before foreach loop and select only the dateTime column values from the table and store it in a variable and in the foreach loop use Foreach from variable enumerator in the collection tab and select the variable created in the above execute sql task .

    希望这对您有帮助.

    这篇关于用于数据流任务的Foreach循环容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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