Browse 536 attributed reviews, viewable separately for our classroom and online training
Variable Scope in Integration Services 2012
A quick blog on how to change the scope of any variable in SQL Server Integration Services 2012.

Posted by Andy Brown on 16 April 2013

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Changing the Scope of a Variable in SSIS 2012

Another small blog on something which just caught me out.  Virtually everything on the Internet says that you can create a variable scoped to a particular task as follows:

Data flow task selection Adding a variable
Select the task, then ... ... add the variable.

The only problem is: it's changed in Integration Services 2012!

This blog assumes that you know what variables are about - it's just to solve a specific problem.

The SSIS 20120 way to change variable scope

You can add a new variable in SSIS 2012 using the Variables window:

Adding variable

Adding a variable - you'll notice I've already created one!


You can then choose to move the variable (an odd term):

Moving a variable

Click on this icon to change the scope of the selected variable.


Select the task which should contain the variable:

Scope of task

Here we'll restrict the variable to the Script Task shown selected.


Yeah - the scope has changed!

New scope

The scope is now restricted to a specific task.


Don't forget you may need to select the task to see the variables it contains, since by default you only see those with package scope.

This blog has 0 threads Add post