execute sql task with 2 variables

  • Hello, possibly simple problem to solve, but I can't get it.

    I have 2 variables I would like to access in an Execute SQL Task.

    They are on the mapping page named 0 and 1 and are user variables with package scope.

    inside the task, I have declared variables to receive the input var's values:

    Declare @NewVar int (assume var 0)

    Set @NewVar = ?

    Declare @OtherVar int (assume var 1)

    Set @OtherVar = ?

    which works fine for first variable, but I'm not getting the value assigned to @OtherVar. Would I need to provide more identification as to which parameter??

    I'm not clear on what syntax I would use in that case, something like "Parameters(1)" ?

    Thanks in advance for getting me unstuck.

  • Not sure, but have you tried using an expression, rather than parameters, to do this? Then you can quite clearly see where your variables are going.

    You could also try something like (after declaration)

    Select @NewVar = ?, @OtherVar = ?

    - maybe it will work better because you are doing the entire assignment in one statement.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Thank you! that worked!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply