How to apply SSIS Package Configuration using Environment Variable with example?. We previously described the list of Package Configurations in the SSIS Package Configuration article.
Before we start the SSIS package configuration, You have to create environment variables. So that you can access them while configuring the package. To create Environment Variables, Go to the Control Panel -> System and Security -> System and click on the Advanced System Settings.
Or Right-click on the My Computer, select the properties, and then select Advanced System Settings will open the System properties.
Simple, and elegant way is type Environment Var in the search bar, and select the Edit the System Environment variables option.
By selecting the Edit the System Environment variables option, the system properties window will open. To add a new system variable, please click on the Environment variables.. button.
Once you click on the Environment variables.. button, below shown window will open. Here you can see all the existing variables and their values. Please click on the New.. button to add a new variable.
As you can see we are adding Variable Name as EducationDetails, and Variable Value as Bachelors
Next, we are creating one more variable Variable Name as IncomeVariable, and Variable Value as 70000
Click OK to close the Environment Variables window
SSIS Package Configuration Using Environment Variable Example
Before we start SSIS package configuration using an environment variable, let me execute the package and see what is it returning.
Right-click on the control flow region will open the context menu. Please select the Package Configurations.. option from it
Once you select the Package Configurations.., a new window called Package Configurations Organizer opened.
Please checkmark the Enable Package Configurations to enable the configurations. Next, click on the Add button to add a new SSIS Package Configuration using Environment Variable.
Clicking the Add button will open a wizard. Please, checkmark Don’t show this page again to avoid this first page.
Select Configuration type: This is the page that we have to use to select the configuration type. By default, the XML configuration file selected by the SSIS
Here, we are explaining about SSIS package configuration using an environment variable. So, let me choose the Environment Variable as the configuration type.
As you can see, we are selecting the EducationDetails variable. Remember, if you don’t find the newly created variable, please close the projects, and reopen the BIDS.
Select Target Property: You have to specify the target value here. It may be variable or connection manager settings.
Here we want to assign this Environment variable to package variable (InputEducation) value. It means, a default value of InputEducation, i.e., Masters Degree, will replace with the Bachelors at run time.
Let me rename the Configuration name as Education Details Configuration, and Click the Finish button to close the wizard.
Now you can see our newly created Environment variable configuration that holds the Education value.
Use the same approach to add one more package configuration of type Environment Variable. This time we are selecting the IncomeVariable and assigning it to the InputYearlyIncome variable (package variable).
Let me assign the configuration name as Income Variable Configuration.
Now you can see our newly created Environment variables configurations. Click OK to close the window
Let us Run the package to see the result.
From the above screenshot, you can see that it is displaying the records whose Education is Bachelors, and yearly Income is 70000. It means, package variables values replaced by the Environment variable values