July 8, 2008 at 11:39 pm
I have some global variables which are set at run time in DTS packages. Now I want to use those variables in my execute SQLtask to set some local variables. I am not able to do so. Whenever I do that, I get an error message saying syntax error or access violation.
I used it as
set @localvariable=?
where ? is global variable passed as parameter.
how to achieve this. Is there any other way? I would thank if I get some pointers about it.....
July 10, 2008 at 6:16 am
nikhil8960 (7/8/2008)
I have some global variables which are set at run time in DTS packages. Now I want to use those variables in my execute SQLtask to set some local variables. I am not able to do so. Whenever I do that, I get an error message saying syntax error or access violation.I used it as
set @localvariable=?
where ? is global variable passed as parameter.
how to achieve this. Is there any other way? I would thank if I get some pointers about it.....
there is a simple solution, I don't remember where I got it but it works
- First define the global variable
- Create an ExecuteSqltask
- enter a line (make sure it is the first line!!) in following style (replace sometable where somecolumn with existing ones of your connection)
Select null from sometable where somecolumn = ?
- then click on the Parameters button and you'll be able to link the global variable to the parameter
- now put the first line in comment (you can also drop it but you might need it again in the future)
- now enter your sqlstatements including the set @localvariable = ?
on execution your @localvariable will get the value of the global variable
hope it works for you as it does for me
Marc
November 11, 2008 at 9:41 pm
Thank you for this post!
It didn't give me the exact solution but it did help me figure out the cause of my problem. I still consider this post as great help on my problem.
I get the same error message but what I did is to remove the my comment from the SQL Query and placed it at the end. My query ran perfectly without the Syntax or the access error.
Cheers,
Leh
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply