成都创新互联网站制作重庆分公司

SSIS参数的值

    

专注于为中小企业提供成都网站设计、网站制作服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业双湖免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了上千企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。

一,SSIS Parameter Value 的type

一个Parameter的Value共有三种类型,分别是Design Value,Server Value,Execution Value。

Design Value是指设计值,在SSDT中设计package时,为某一个Parameter指定的Default value。

Server value:一旦package部署到Sql Server上,就会生成一个Server Value,默认的Server Value和Design Value相同,可以通过SSMS来修改Parameter的Server Value。

Execution Value:在Package执行时,Parameter的value是Execution Value。通常情况下,Package在执行时,会读取Server Value作为parameter的Execution value。当通过Execute来设置Parameter的Execution Value时,Package将使用这个value作为Execution value,在Execute中指定的Execution value不会覆盖Server value,只适用于这次Execution。

 

 

1,通过 catalog.object_parameters 视图查看Design Value和 Server Value

select op.parameter_id,op.parameter_name,op.object_type,op.object_name,
        op.data_type,op.required,op.sensitive,op.design_default_value,op.default_value as ServerDefulatValuefrom catalog.object_parameters op

SSIS 参数的值

 

2,修改parameter的Server value 

选择Project,右击弹出快捷菜单,选择Configure,配置parameters

 

SSIS 参数的值

 

SSIS 参数的值

 

3,通过 catalog.execution_parameter_values 查看Execution value

 

select epv.parameter_name,epv.parameter_value,epv.parameter_data_type,epv.sensitive,epv.requiredfrom catalog.execution_parameter_values epv

SSIS 参数的值

 

 

4,指定parameter的Execution value

默认情况下,Parameter的Execution value是Parameter的Server value,但是也可以通过Execute指定一个Execution value。

选择package,右键弹出快捷菜单,选择Execute,Parameter 默认的Execution Value是Server value,可以点击 ... 为Parameter设置一个Execution value。

SSIS 参数的值

SSIS 参数的值

 

5,Parameter value的有效性

可以通过Validate来检查package的有效性,在package执行之前,验证package的有效性

SSIS 参数的值 

 6,Parameter的信息存储在SSISDB中,实际上,实现的功能和Package Deployment Model下的Configurations是相同的,用于将Package执行的property配置到DB中,在package执行的时候,去读取配置信息,然后执行package;在必要时,修改package的parameter value.

 

7,使用catalog.set_object_parameter_value 存储过程来修改Parameter 的Server value。

 

Sets the value of a parameter in the Integration Services catalog. Associates the value to an environment variable or assigns a literal value that will be used by default if no other values are assigned.

 

SSIS 参数的值

set_object_parameter_value [ @object_type = ] object_type 
    , [ @folder_name = ] folder_name 
    , [ @project_name = ] project_name 
    , [ @parameter_name = ] parameter _name 
    , [ @parameter_value = ] parameter_value 
 [  , [ @object_name = ] object_name ] [  , [ @value_type = ] value_type ]

SSIS 参数的值

Arguments       

  • [ @object_type = ] object_type              

  • The type of parameter. Use the value 20 to indicate a project parameter or the value 30 to indicate a package parameter. The object_type is smallInt.

  • [ @folder_name = ] folder_name              

  • The name of the folder that contains the parameter. The folder_name is nvarchar(128).

  • [ @project_name = ] project_name              

  • The name of the project that contains the parameter. The project_name is nvarchar(128).

  • [ @parameter_name = ] parameter_name              

  • The name of the parameter. The parameter_name is nvarchar(128).

  • [ @parameter_value = ] parameter_value              

  • The value of the parameter. The parameter_value is sql_variant.

  • [ @object_name = ] object_name              

  • The name of the package. This argument required when the parameter is a package parameter. The object_name is nvarchar(260).

  • [ @value_type = ] value_type              

  • The type of parameter value. Use the character V to indicate that parameter_value is a literal value that will be used by default of no other values are assigned prior to execution. Use the character R to indicate that parameter_value is a referenced value and has been set to the name of an environment variable. This argument is optional, the character V is used by default. The value_type is char(1).

 Remarks                                  

  • If no value_type is specified, a literal value for parameter_value is used by default. When a literal value is used, the value_set in the object_param eters view is set to 1. A NULL parameter value is not allowed.

  • If value_type contains the character R,  which denotes a referenced value, parameter_value refers to the name of an environment variable.

  • The value 20 may be used for object_type to denote a project parameter. In this case, a value for object_name is not necessary, and any value specified for object_name is ignored. This value is used when the user wants to set a project parameter.

  • The value 30 may be used for object_type to denote a package parameter. In this case, a value for object_name is used to denote the corresponding package. If object_name is not specified, the stored procedure returns an error and terminates.

 

修改Parameter 的Server Value的脚本如下:

SSIS 参数的值

select *    from catalog.object_parameters opselect *from [catalog].[folders]select *from [catalog].[projects]exec catalog.set_object_parameter_value 
     @object_type = 30
    , @folder_name =N'TestISProject'
    , @project_name = N'TestISProject'
    , @parameter_name = N'ParameterA'
    , @parameter_value = 9
    , @object_name = N'Package1.dtsx'
    , @value_type = N'V'

SSIS 参数的值


Note:使用该存储过程修改的是Parameter的Server value,可以通过视图:catalog.object_parameters 字段 default_value来查看parameter的server value。

 

二,Parameter Values type

You can assign up to three different types of values to a parameter. When a package execution is started, a single value is used for the parameter, and the parameter is resolved to its final literal value.

The following table lists the types of values.

Value Name

Description

Type of value

Execution Value

The value that is assigned to a specific instance of package execution. This assignment overrides all other values, but applies to only a single instance of package execution.

Literal

Server Value

The value assigned to the parameter within the scope of the project, after the project is deployed to the Integration Services server. This value overrides the design default.

Literal or Environment Variable Reference

Design Value

The value assigned to the parameter when the project is created or edited in SQL Server Data Tools. This value persists with the project.

Literal

You can use a single parameter to assign a value to multiple package properties. A single package property can be assigned a value only from a single parameter.

 

Executions and Parameter Values

The execution is an object that represents a single instance of package execution. When you create an execution, you specify all of the details necessary to run a package such as execution parameter values. You can also modify the parameters values for existing executions.

When you explicitly set an execution parameter value, the value is applicable only to that particular instance of execution. The execution value is used instead of a server value or a design value. If you do not explicitly set an execution value, and a server value has been specified, the server value is used.

When a parameter is marked as required, a server value or execution value must be specified for that parameter. Otherwise, the corresponding package does not execute. Although the parameter has a default value at design time, it will never be used once the project is deployed.

 

Environment Variables

If a parameter references an environment variable, the literal value from that variable is resolved through the specified environment reference and applied to the parameter. The final literal parameter value that is used for package execution is referred to as the execution parameter value. You specify the environment reference for an execution by using the Execute dialog box

If a project parameter references an environment variable and the literal value from the variable cannot be resolved at execution, the design value is used. The server value is not used.

To view the environment variables that are assigned to parameter values, query the catalog.object_parameters view. For more information, see catalog.object_parameters (SSISDB Database).

 

Determining Execution Parameter Values

The following Transact-SQL views and stored procedure can be used to display and set parameter values.

  • catalog.execution_parameter_values (SSISDB Database)(view)

  • Shows the actual parameter values that will be used by a specific execution

  • catalog.get_parameter_values (SSISDB Database) (stored procedure)

  • Resolves and shows the actual values for the specified package and environment reference

  • catalog.object_parameters (SSISDB Database) (view)

  • Displays the parameters and properties for all packages and projects in the Integration Services catalog, including the design default and server default values.

  • catalog.set_execution_parameter_value (SSISDB Database)

  • Sets the value of a parameter for an instance of execution in the Integration Services catalog.

You can also use the Execute Package dialog box in SQL Server Data Tools (SSDT) modify the parameter value. For more information, see Execute Package Dialog Box.

You can also use the dtexec /Parameter option to modify a parameter value. For more information, see dtexec Utility.

 

Parameter Validation

If parameter values cannot be resolved, the corresponding package execution will fail. To help avoid failures, you can validate projects and packages by using theValidate dialog box in SQL Server Data Tools (SSDT). Validation allows you to confirm that all parameters have the necessary values or can resolve the necessary values with specific environment references. Validation also checks for other common package issues.

For more information, see Validate Dialog Box.

 


分享题目:SSIS参数的值
链接分享:http://cxhlcq.com/article/jdhcdp.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部