SSIS variable not changing its value

  • In a simple SSIS 2012 package I'm trying to change the value of a variable (name vValue).

    The default value is based on a project parameter: $Project::OldValue

    The ReadOnly property is set to false.

    EvaluateAsExpression is set to true with expression set to @[$Project::OldValue]

    I'm using a Expression Task to change value of the "vValue" variable with the following expression:

    @[User::vValue] = @[$Project::NewValue]

    However breakpoints on the task show that the variables value hasn't changed.

    Tried the same with a script task, to no avail.

    Is this a known issue or am I doing something wrong?

  • Don't use an expression for the default value.

    That expression will be evaluated every time the variable is referenced.

    So what is happening is that your Expression task is setting the variable value, and but when you later reference that variable, the expression is automatically evaluated setting the value back to your default value.

    You have two options:

    Remove the expression on the variable itself, and set the value at run-time with the expression task.

    Use the expression to set the value based on your newvalue variable.

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

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