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.

Open System Environment Variables Window

A simple and elegant way is to type Environment Var in the search bar and select the Edit the System Environment variables option.

Edit System Environment Variables

The system properties window will open by selecting the Edit the System Environment variables option. Please click on the Environment variables.. button to add a new system variable.

Create Environment Variable

Once you click the Environment variables.. button, the window below will open. Here, you can see all the existing variables and their values. Please click on the New.. button to add a new variable.

Create a New

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

Add Name and Value

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

Create Another one

Click OK to close the Environment Variables window

View Environment Variables

SSIS Package Configuration Using Environment Variable Example

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

SSIS Package Configuration Using Environment Variable 8

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

SSIS Package Configuration option for Environment Variable

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

Package Configuration Organizer using Environment Variable 10

Please checkmark the Enable Package Configurations to enable the configurations. Next, click the Add button to add a new SSIS Package Configuration using Environment Variable.

SSIS Enable Package Configuration using Environment Variable 11

Clicking the Add button will open a wizard. Please check 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 we must use to select the configuration type. By default, the XML configuration file is selected by it.

Please refer to the below links for the remaining configurations.

  1. Parent-Child Package Configuration
  2. Registry Entry
  3. Server Configuration
  4. XML Configuration File
  5. XML Configuration File in Environment Variable
SSIS Package Configuration Using Environment Variable 13

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

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

We want to assign this Environment variable to the 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 it 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 with 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 select the IncomeVariable and assign it to the InputYearlyIncome variable (package variable).

SSIS Package Configuration Using Environment Variable 20

Let me assign the name Income Variable Configuration.

Finish Wizard

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

The above screenshot shows that it displays the records whose Education is Bachelors, and yearly Income is 70000. It means that the Environment variable values replace package variables values