SSIS Passing Parameters to an ADO .NET Source query;向ado.net数据源传递参数。

来源:互联网 发布:扶摇直上九万里的网络 编辑:程序博客网 时间:2024/04/30 00:56

使用SSIS的oledb数据源时的参数按钮如下图: 


但是在使用ADO.NET源连接到MYSQL时,没有这个参数按钮,如何向数据流的sql command传递参数呢?


steps:

1. 在 控制流 选项卡上,在包含ado.net源的 data flow task上右键选择属性->设置 Expressions。


2.属性表达式编辑器中设置如下:


属性:选择 ADO.NET源.SQLCommand,注意,ADO.NET源是 ado.net源的名称,如果您变更过组件名称,则这里是您自定义的名称.sqlcommand。

表达式:点击后边的按钮,填写你的sql语句以及从变量和参数传递过来的值,即 本例子中的  @[User::PV_WaterMarkValue],然后点击计算表达式按钮:

说明:使用了字符串拼接的方式,注意“”及‘’。

我这里的例子是:

"select    cast(date_format(orderdate,'%Y%m%d') as signed) as datekey,`order`.*, branchoffice.BranchOfficeName  from `order` inner join branchoffice on `order`.BranchOfficeSN=branchoffice.BranchOfficeSN where `order`.orderdate >'"+  @[User::PV_WaterMarkValue]+"'"


这样,Data flow task中的ado.net源就得到了从Get Water Mark中返回的值。

 

顺便演示下,Get Water Mark中的值是如何返回的:

1.定义变量


2.给变量赋值


3. 设置结果集




http://www.cnblogs.com/shuzhenyu/p/5613239.html



原创粉丝点击