Add, Delete, Change Scope of User-Defined Variable in a Package
These procedures describe how to add, delete, and change the scope of a user-defined variable in a package by using the Variables window.
For more information about variable scope, see Integration Services (SSIS) Variables.
Integration Services also provides system variables that make system information available at run time and can be used in containers such as packages and event handlers. You cannot delete system variables.
To add a variable
In SQL Server Data Tools (SSDT), open the Integration Services package you want to work with.
In Solution Explorer, double-click the package to open it.
In SSIS Designer, to define the scope of the variable, do one of the following:
To set the scope to the package, click anywhere on the design surface of the Control Flow tab.
To set the scope to an event handler, select an executable and an event handler on the design surface of the Event Handler tab.
To set the scope to a task or container, on the design surface of the Control Flow tab or the Event Handler tab, click a task or container.
On the SSIS menu, click Variables. You can optionally display the Variables window by mapping the View.Variables command to a key combination of your choosing on the Keyboard page of the Options dialog box.
In the Variables window, click the Add Variable icon. The new variable is added to the list.
Optionally, click the Grid Options icon, select additional columns to show in the Variables Grid Options dialog box, and then click OK.
Optionally, set the variable properties. For more information, see Set the Properties of a User-Defined Variable.
To save the updated package, click Save Selected Items on the File menu.
To delete a variable
In SQL Server Data Tools (SSDT), open the Integration Services project that contains the package you want.
In Solution Explorer, right-click the package to open it.
On the SSIS menu, click Variables. You can optionally display the Variables window by mapping the View.Variables command to a key combination of your choosing on the Keyboard page of the Options dialog box.
Select the variable to delete, and then click Delete Variable.
If you don’t see the variable in the Variables window, click Grid Options and then select Show variables of all scopes.
If the Confirm Deletion of Variables dialog box opens, click Yes to confirm.
To save the updated package, click Save Selected Items on the File menu.
To change the scope of a variable
In SQL Server Data Tools (SSDT), open the Integration Services project that contains the package you want.
In Solution Explorer, right-click the package to open it.
On the SSIS menu, click Variables. You can optionally display the Variables window by mapping the View.Variables command to a key combination of your choosing on the Keyboard page of the Options dialog box.
Select the variable and then click Move Variable.
If you don’t see the variable in the Variables window, click Grid Options and then select Show variables of all scopes.
In the Select New Scope dialog box, select the package or a container, task, or event handler in the package, to change the variable scope.
To save the updated package, click Save Selected Items on the File menu.
Zobacz także
Zadania
Set the Properties of a User-Defined Variable
Use the Values of Variables and Parameters in a Child Package