How To Create Variables in SSIS
Variables:-Variables can store the values and can change during runtime. It can be created with various scope ranges like task , container , package , etc.
There are two types of variables:-
- User Defined Variables
- System Defined Variables.
System Defined Variables are read-only variables.
Procedure:-
- Creating package under Project “doc1”.
- Under Solution Explorer we need to rename the package as required. i.e. dtsx .
- Drag and Drop the Execute SQL Task from the toolbox to the control flow region.
- Right click on workspace we can see the variable option and click on the variables.
- Create one variable id and change the data type and give the value as shown above.
- Double click on Execute SQL Task and specify the connections and write the SQL Query as shown below.
- Go to parameter mapping and click on add and select the variable name and give the parameter name and value as shown below.
- Go to Start and Execute the Package .
Output:- Here from the table emp_tgt_m where the id=3 rows will be deleted as shown below.