In this article we will show you, How to apply SSIS Package Configuration using Environment Variable with example. We already explained the list of Package Configurations in our previous article. SO, please refer SSIS Package Configuration to understand the same.
Before we start the package configuration, You have to create environment variables. So that you can access them while configuring the package. In order 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 search bar, and select the Edit the System Environment variables option as we shown below.
By selecting the Edit the System Environment variables option, system properties window will be opened as we shown below. In order to add new system variable, please click on the Environment variables.. button.
Once you click on the Environment variables.. button, below shown window will be opened. Here you can see all the existing variables, and its values. Please click on the New.. button to add 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 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 the context menu
Once you select the Package Configurations.., a new window called Package Configurations Organizer will be opened as we shown below.
Please check mark the Enable Package Configurations to enable the configurations. Next, click on the Add button to add new configuration.
Clicking the Add button, will open a wizard. First page is the welcome wizard, please check mark Don’t shown this page again to avoid this page.
Select Configuration type: This is the page that we have to use to select the configuration type. By default XML configuration file is selected by the SSIS
In this example we are explaining about SSIS package configuration using environment variable. So, let me select 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. This may be variable, or connection manager settings.
Here we want to assign this Environment variable to package variable (InputEducation) value. It means, default value of InputEducation i.e., Masters Degree will be replaced with the Bachelors at run time.
Let me rename the Configuration name as Education Details Configuration, and Click 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 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 are replaced by the Environment variable values
Thank You for Visiting Our Blog