如何将一个变量中的一个参数中的多个值传递给 SSIS 的 OLEDB 源 [英] How to pass multiple value in one parameter in one variable to OLEDB Source of SSIS

查看:25
本文介绍了如何将一个变量中的一个参数中的多个值传递给 SSIS 的 OLEDB 源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将多个值作为一个参数传递.例如:我需要在 (1,2,3,4,5) 中获取 employeeIDemployeeID 字段数据类型为整数.

I am trying to pass multiple values as one parameter. e.g: I need to get the employeeID in (1,2,3,4,5), employeeID field data type is Integer.

查询:

select * from emp where employeeID = ?

我创建了一个变量 'v_employeeID',值为 1 并传递了 OLEDB Source 中的参数映射.我可以传递一个值,但我不能传递多个值.

I Create a variable 'v_employeeID' with the value 1 and passed the parameter mapping in OLEDB Source. I can pass one value but I cant pass multiple value.

推荐答案

一个简单的解决方案是将整个查询变成一个变量.如果您的 @employeeID 变量包含1,2,3"(顺便说一下,它必须是一个字符串变量),那么您的 @SQLQuery 变量将是:

A simple solution is to make your entire query a variable. If your @employeeID variable contains "1,2,3" (it will have to be a string variable, by the way), then your @SQLQuery variable would be:

"select * from emp where employeeID IN (" + @employeeID +")"

然后在您的 OLEDB 源中,使用从变量查询"选项,并使用 @SQLQuery 变量作为源.

Then in your OLEDB Source, use the "Query from Variable" option, and use the @SQLQuery variable as the source.

这篇关于如何将一个变量中的一个参数中的多个值传递给 SSIS 的 OLEDB 源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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