[英]SSIS execute sql task parameter mapping
I'm trying to execute a sql script using the task in SSIS.我正在尝试使用 SSIS 中的任务执行 sql 脚本。
My script just inserts a bunch of nambe value pairs in a table.我的脚本只是在表中插入了一堆 nambe 值对。 For example -
例如 -
insert into mytable (name, value) values (?, 'value1'), (?, 'value2')插入 mytable (name, value) 值 (?, 'value1'), (?, 'value2')
Now, I want to map a variable defined in SSIS to be mapped to the parameters in the statement above.现在,我想将 map 中定义的一个变量 SSIS 映射到上面语句中的参数。 I tried defining a scalar variable but I guess the sql task doesn't like that.
我尝试定义一个标量变量,但我猜 sql 任务不喜欢那样。 Oh and all the name parameters in the insert statement resolve to a single variable.
哦,插入语句中的所有名称参数都解析为单个变量。
For example I want insert into mytable (name, value) values ('name1', 'value1'), ('name1', 'value2')例如我想插入到 mytable (name, value) 值 ('name1', 'value1'), ('name1', 'value2')
When I open the Parameter Mapping tab for the task, it wants me to map each parameter invidually like -当我打开任务的参数映射选项卡时,它希望我将 map 每个参数单独设置为 -
Variable Name - User::Name Direction - Input Data Type - LONG Parameter Name - 0 Parameter Size - -1变量名称 - User::Name 方向 - 输入数据类型 - LONG 参数名称 - 0参数大小 - -1
Variable Name - User::Name Direction - Input Data Type - LONG Parameter Name - 1 Parameter Size - -1变量名称 - User::Name 方向 - 输入数据类型 - LONG 参数名称 - 1参数大小 - -1
This quickly gets out of hand and cumbersome if have 5-10 values for a name and forces me to add multiple assignments for the same name.如果一个名称有 5-10 个值,这很快就会变得失控和繁琐,并迫使我为同一个名称添加多个分配。
Is there an easy(-ier) way to do this?有没有简单(-ier)的方法来做到这一点?
The easiest (and most extensible) way, is to use a Data Flow Task instead of using an Execute SQL Task.最简单(也是最可扩展)的方法是使用数据流任务而不是使用执行 SQL 任务。
The good thing about this method is that you can make as extensible as you wish... validate each value with different criteria, modify the data, add business rules, discard non-compliant values (by checking the full number of complying values)... !这种方法的好处是您可以随心所欲地扩展...使用不同的标准验证每个值、修改数据、添加业务规则、丢弃不合规的值(通过检查合规值的全部数量)。 .. !
Have a nice day!祝你今天过得愉快!
Francisco.弗朗西斯科。
PS: I had prepared a couple more screenshots... but stackoverflow has decided that I am too new to the site to post things with images or more than two links (.) Oh well.. PS:我准备了更多的屏幕截图......但是stackoverflow决定我对这个网站太陌生了,不能发布带有图片或两个以上链接的东西(。)哦,好吧......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.