SSIS 从平面文件中获取数据并分配给变量 [英] SSIS Get data from a Flat file and assign to variable

查看:22
本文介绍了SSIS 从平面文件中获取数据并分配给变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 SSIS 中,我想从平面文件(平面文件源)中读取数据并将某些列值分配给 SSIS 中的变量(如 IDNo).我需要此 ID 来检索其他信息,例如电子邮件和其他详细信息,以便在此过程中稍后动态发送电子邮件.我做了一些研究,我发现脚本组件是为变量赋值的方法之一,但在我们的环境中脚本组件不可用.如果可以,是否有可能做到这一点,请有人给我提供样品.谢谢.

In SSIS, i want to read data from a flat file(Flat File Source) and assign certain column values to a variable in SSIS (like IDNo). I need this ID to retrive other information like email and other details to send email dynamically later in the process. I did some reasearch i found that Script Component is one of the way to assign values to variables, but in our environment script component is not available. Is it possible to do that if so, can some one please provide me a sample. thanks.

推荐答案

您不一定需要脚本组件来实现这一点.

You don't necessarily need script component to achieve this.

  1. 将您的 ID 读取到记录集(这将是 Object 类型的变量):

  • 创建一个 Object 类型的变量.
  • Data Flow Task中创建一个Recordset Destination.
  • VariableName 下拉菜单中选择您的变量.
  • Create a variable of type Object.
  • In Data Flow Task create a Recordset Destination.
  • Pick your variable in VariableName dropdown.

创建Foreach循环容器:

  • Enumerator设置中选择Foreach ADO Enumerator.
  • As ADO object source variable 从下拉列表中选择您的记录集变量
  • Variable Mappings 中为您的电子邮件变量分配索引 0
  • Choose Foreach ADO Enumerator in Enumerator setting.
  • As ADO object source variable pick your recordset variable from the dropdown list
  • In Variable Mappings assign your email variable with index 0

使用电子邮件变量作为 Send Email Task 中的表达式从循环发送电子邮件.

Send the emails from the loop using email variable as an expression in Send Email Task.

为什么脚本组件不可用?它会让事情变得更容易,并有助于避免一些问题;我不再使用邮件任务,而是使用脚本任务,因为我过去遇到过一些问题.

Why is script component not available? It'd make things easier and help to avoid some problems; I don't use mail task anymore in favour of script task, because I ran to some problems with it in the past.

希望这会有所帮助.

这篇关于SSIS 从平面文件中获取数据并分配给变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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