x
login about faq Site discussion (meta-askssc)

How to update a user variable in Dynamic SQL in Oledb Source Components

I created 2 variables

1) @[user::var] of type int,initialize with 0 and updated at runtime

2) @[user:sSQL] of type string and value is Select column1 from table1 where column1 > @[user::var] and I set the property EvaluateAsExpression to true

I am using @[user::sSQL] in an Oledb source component,when I run my package I validate that @[user::var] gets updated but the updated value does not pass through to the @[user::sSQL] rather @[user::sSQL] still has 0 instead of the updated value.

How do I make the dynamic sql to use the updated @[user::var]?

I will greatly appreciate a quick response.

Thanks,

Ed

more ▼

asked Apr 14 '10 at 12:40 PM in Default

Ed Donald gravatar image

Ed Donald
1 1 1 1

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

1 answer: sort oldest

Hi Ed,

When you have the variable and the expression, have you validated the expression in the expression builder?

Also, could you include the exact text that is in your variable? In my experience there should be double qoutes around the text and the variable should be outside those quotes, like this;

"Select column1 from table1 where column1 > " + @[user::var]

Also, make sure that the variable user::var is in scope

more ▼

answered Apr 15 '10 at 01:30 AM

Daniel Ross gravatar image

Daniel Ross
2.9k 6 10 12

(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.

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



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x750
x600
x47

asked: Apr 14 '10 at 12:40 PM

Seen: 1603 times

Last Updated: Apr 14 '10 at 12:40 PM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.