SSIS Package Configuration using Environment Variable

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.

SSIS Package Configuration Using Environment Variable 2

Simple, and elegant way is type Environment Var in the search bar, and select the Edit the System Environment variables option.

SSIS Package Configuration Using Environment Variable 1

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.

SSIS Package Configuration Using Environment Variable 3

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.

SSIS Package Configuration Using Environment Variable 4

As you can see we are adding Variable Name as EducationDetails, and Variable Value as Bachelors

SSIS Package Configuration Using Environment Variable 5

Next, we are creating one more variable Variable Name as IncomeVariable, and Variable Value as 70000

SSIS Package Configuration Using Environment Variable 6

Click OK to close the Environment Variables window

SSIS Package Configuration Using Environment Variable 7

SSIS Package Configuration Using Environment Variable Example

Before we start SSIS Package Configuration using an environment variable, let me execute the SSIS package and see what is it returning.

SSIS Package Configuration Using Environment Variable 8

Right-click on the control flow region will open the context menu. Please select the Package Configurations.. option from it

SSIS Package Configuration Using Environment Variable 9

Once you select the Package Configurations.., a new window called Package Configurations Organizer opened.

SSIS Package Configuration Using Environment Variable 10

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.

SSIS Package Configuration Using Environment Variable 11

Clicking the Add button will open a wizard. Please, checkmark Don’t show this page again to avoid this first page.

SSIS Package Configuration Using Environment Variable 12

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

SSIS Package Configuration Using Environment Variable 13

Here, we are explaining about SSIS package configuration using an environment variable. So, let me choose the Environment Variable as the configuration type.

SSIS Package Configuration Using Environment Variable 14

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.

SSIS Package Configuration Using Environment Variable 15

Select Target Property: You have to specify the target value here. It may be variable or connection manager settings.

SSIS Package Configuration Using Environment Variable 16

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.

SSIS Package Configuration Using Environment Variable 17

Let me rename the Configuration name as Education Details Configuration, and Click the Finish button to close the wizard.

SSIS Package Configuration Using Environment Variable 18

Now you can see our newly created Environment variable configuration that holds the Education value.

SSIS Package Configuration Using Environment Variable 19

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).

SSIS Package Configuration Using Environment Variable 20

Let me assign the configuration name as Income Variable Configuration.

SSIS Package Configuration Using Environment Variable 21

Now you can see our newly created Environment variables configurations. Click OK to close the window

SSIS Package Configuration Using Environment Variable 22

Let us Run the package to see the result.

SSIS Package Configuration Using Environment Variable 23

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