catalog.create_environment_variable
TOC
Collapse the table of content
Expand the table of content

catalog.create_environment_variable (SSISDB Database)

 

THIS TOPIC APPLIES TO: yesSQL Server (starting with 2012)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Create an environment variable in the Integration Services catalog.

create_environment_variable [ @folder_name = ] folder_name  
    , [ @environment_name = ] environment_name  
    , [ @variable_name = ] variable_name  
    , [ @data_type = ] data_type  
    , [ @sensitive = ] sensitive  
    , [ @value = ] value  
    , [ @description = ] description  

[ @folder_name = ] folder_name
The name of the folder that contains the environment. The folder_name is nvarchar(128).

[ @environment_name = ] environment_name
The name of the environment. The environment_name is nvarchar(128).

[ @variable_name = ] variable_name
The name of the environment variable. The variable_name is nvarchar(128).

[ @data_type = ] data_type
The data type of the variable. Supported environment variable data types include Boolean, Byte, DateTime, Double, Int16, Int32, Int64, Single, String, UInt32, and UInt64. Unsupported environment variable data types include Char, DBNull, Object, and Sbyte. The data type of the data_type parameter is nvarchar(128).

[ @sensitive = ] sensitive
Indicates whether the variable contains a sensitive value or not. Use a value of 1 to indicate that the value of the environment variable is sensitive or a value of 0 to indicate that it is not. A sensitive value is encrypted when it is stored. A value that is not sensitive is stored in plaintext.Sensitive is bit.

[ @value = ] value
The value of the environment variable. The value is sql_variant.

[ @description = ] description
The description of the environment variable. The value is nvarchar(1024).

0 (success)

None

This stored procedure requires one of the following permissions:

  • READ and MODIFY permissions on the environment

  • Membership to the ssis_admin database role

  • Membership to the sysadmin server role

The following list describes some conditions that may raise an error or warning:

  • The folder name, environment name, or environment variable name is not valid

  • The variable name already exists in the environment

  • The user does not have the appropriate permissions

An environment variable can be used to efficiently assign a value to a project parameter or package parameter for use in the execution of a package. Environment variables enable the organization of parameter values. Variable names must be unique within an environment.

The stored procedure validates the data type of the variable to make sure it is supported by the Integration Services catalog.

System_CAPS_ICON_tip.jpg Tip


Consider using the Int16 data type in Integration Services instead of the unsupported Sbyte data type.

The value passed to this stored procedure with the value parameter will be converted from an Integration Services data type to a SQL Server data type according to the following table:

Integration Services Data TypeSQL Server Data Type
Booleanbit
Bytebinary, varbinary
DateTimedatetime, datetime2, datetimeoffset, smalldatetime
DoubleExact numeric: decimal, numeric; Approximate numeric: float, real
Int16smallint
Int32int
Int64bigint
SingleExact numeric: decimal, numeric; Approximate numeric: float, real
Stringvarchar, nvarchar, char
UInt32int (This is the closest available mapping to Uint32.)
UInt64bigint (This is the closest available mapping to Uint64.)

Community Additions

ADD
Show:
© 2016 Microsoft