x

SSIS and Variables from SQL 2005 query

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

Jack Woo

more ▼

asked Oct 23 '09 at 09:49 AM in Default

JackWoo gravatar image

JackWoo
11 1 1 1

(comments are locked)
10|1200 characters needed characters left

1 answer: sort newest

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

more ▼

answered Oct 23 '09 at 05:39 PM

Tom Staab gravatar image

Tom Staab
5.8k 6 8 10

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x900
x26

asked: Oct 23 '09 at 09:49 AM

Seen: 2299 times

Last Updated: Oct 23 '09 at 09:49 AM