2

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 = ?

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.

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

2 Answers 2

3

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.

enter image description here

ResultSet set to Single row

enter image description here

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

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

-2

Given your table is Table and a column is Column_name and Column_name_two you can do something like this.

SELECT @yourVar = Column_name,
       @yourSecondVar = Column_name_two
FROM Table
WHERE Table_id = 1

3 Comments

Do the parameter need to be set as output?
I'm assuming you can just do DECLARE @yourVar type before the SELECT
Sounds like this should work but I wen with billinkc's solution to keep it simple.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.