Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Variables to Global Variables in "Execute SQL Task"

Status
Not open for further replies.

gradley

Programmer
Feb 24, 2004
335
US
Has anyone found a proper way to set a declared variable in an "Execute SQL Task" to an incoming Global Variable parameter?

If I use the following script:

Declare @var1 as varchar(10)
SET @var1 = ?

I get a "Syntax error or access violation" error when trying to open the parameters window.

If I fake it out by using a select statement like this:

Select *
from table1
where table_ID = ?

the task allows me to retrieve the parameters window. I can then paste the original code into the window and it works.

Is there a better (proper) way to retrieve parameters into a declared variable that I am not aware of?



 
write your code into stored procedure with parameters. in this case you could pass parameter by global variable
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top