从单行执行 SQL 任务结果对象设置多个变量 [英] Setting multiple variables from a Execute SQL Task result object with a single row

查看:35
本文介绍了从单行执行 SQL 任务结果对象设置多个变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 EXECUTE SQL TASK 中有以下 sql:

I have the following sql in an EXECUTE SQL TASK:

SELECT [CnxnStrValue1] as INT_Support_CnxnStr
,[CnxnStrValue2] as Lawson_CnxnStr
,[CnxnStrValue3] as Lawson_HRIS_CnxnStr
FROM  [dbo].[InterfaceDBCnxn] 
WHERE InterfaceName = ?

结果集被设置为一个对象变量.我还有三个字符串变量来保存值,通常我会将它们映射到 For Each Loop Container.但是,在这种情况下,我的结果集将始终只有一行,因为 InterfaceName 是表的主键.

The result set is set to an object variable. I also have three string variables to hold the values and typically I would map them to a For Each Loop Container. But, in this case, my result set will always only be one row because InterfaceName is the primary key of the table.

在不使用 for 每个循环容器的情况下设置变量的最佳方法是什么?

Whats is the best way to set the variables with out using a for each loop container?

推荐答案

将结果集从 Full 更改为 Single Row.我将这种模式用于我的 DW 加载以获取我的未知成员的代理键值.

Change your result set from Full to Single Row. I use this pattern for my DW loads to get the surrogate key value for my unknown members.

ResultSet 设置为 Single row

ResultSet set to Single row

根据需要映射您的参数.在这里,我有 8 个被映射的变量

Map your parameters as needed. Here, I have 8 variables that get mapped

这篇关于从单行执行 SQL 任务结果对象设置多个变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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