question

JackWoo avatar image
JackWoo asked

SSIS and Variables from SQL 2005 query

How can I (in SSIS) put into variables something from SQL table or query?

Jack Woo

ssisvariable
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Tom Staab avatar image
Tom Staab answered

The easiest way to do this is by mapping the result set to variables. You can also map variables to parameters, but that is typically (but not always) used for passing variable values to the query.

Here's an example using the result set, let's say you have a variable User::UserCount.

Execute SQL Task:

General Page:

SQLStatement = SELECT COUNT(*) AS MyUserCount FROM users
ResultSet = Single row

Result Set Page:

Result Name = MyUserCount
Variable Name = User::UserCount

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.