catalog.create_environment_variable (SSISDB 資料庫)

適用於:SQL Server Azure Data Factory 中的 SSIS Integration Runtime

適用於:SQL Server

在 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_namenvarchar(128)

[@environment_name =] 環境名稱
環境的名稱。 environment_namenvarchar(128)

[@variable_name =] 變數名稱
環境變數的名稱。 variable_namenvarchar(128)

[@data_type =] 資料類型
變數的資料類型。 支援的環境變數資料類型包含 BooleanByteDateTimeDoubleInt16Int32Int64SingleStringUInt32UInt64。 不支援的環境變數資料類型包含 CharDBNullObjectSbytedata_type 參數的資料類型是 nvarchar(128)

[@sensitive =] sensitive
指出變數是否包含機密值。 使用 1 值表示環境變數的值是機密值,或者,使用 0 值則表示該值不是機密值。 機密值會在儲存時加密。 非機密值則會儲存為純文字。Sensitivebit

[@value =] value
環境變數的值。 valuesql_variant

[@description =] description
環境變數的描述。 valuenvarchar(1024)

傳回碼值

0 (成功)

結果集

None

權限

這個預存程序需要下列其中一個權限:

  • 環境的 READ 和 MODIFY 權限

  • ssis_admin 資料庫角色的成員資格

  • 系統管理員伺服器角色的成員資格

錯誤和警告

下列清單將描述可能會引發錯誤或警告的某些條件:

  • 資料夾名稱、環境名稱或環境變數名稱無效

  • 變數名稱已經存在於環境中

  • 使用者未具備適當的權限

備註

環境變數可以用來將值有效地指派給專案參數或封裝參數,以用於封裝的執行中。 環境變數啟用了參數值的組織。 變數名稱在環境中必須是唯一的。

預存程序會驗證變數的資料類型,確定 Integration Services 目錄支援該變數。

提示

請考慮使用 Integration Services 中的 Int16 資料類型,而不要使用不受支援的 Sbyte 資料類型。

根據下表所示,傳遞給此具有 value 參數之預存程序的值,將會從 Integration Services 資料類型轉換為 SQL Server 資料類型:

Integration Services 資料類型 SQL Server 資料類型
布林值 bit
位元組 binaryvarbinary
DateTime datetimedatetime2datetimeoffsetsmalldatetime
Double 精確數值:decimalnumeric;近似數值:floatreal
Int16 smallint
Int32 int
Int64 bigint
Single 精確數值:decimalnumeric;近似數值:floatreal
String varcharnvarcharchar
UInt32 int (intUint32 的最接近可用對應)。
UInt64 bigint (intUint64 的最接近可用對應)。