SSIS Parameter用法

本文涉及的产品
云数据库 RDS SQL Server,基础系列 2核4GB
RDS SQL Server Serverless,2-4RCU 50GB 3个月
推荐场景:
简介:

今天学习SSISParameter的用法,记录学习的过程。

 

Parameters能够在Project Deployment Model下使用,不能在Package Deployment Model使用。在Package Deployment Model下,使用Package Configurations来传递属性值;在Project Deployment Model下,使用Parameters来传递值。

 

1,Parameters and Package Deployment Model

In general, if you are deploying a package using the package deployment model, you should use configurations instead of parameters.

When you deploy a package that contains parameters using the package deployment model and then execute the package, the parameters are not called during execution. If the package contains package parameters and expressions within the package use the parameters, the resulting values are applied at runtime. If the package contains project parameters, the package execution may fail.

 

2,Parameters分为两个Level,Project Level 和 Package Level,这两个level的parameters value都存储在project files。

Project Parameters values  and Packages parameters values are stored in configurations in the project file。

Integration Services (SSIS) parameters allow you to assign values to properties within packages at the time of package execution. You can create project parameters at the project level and package parameters at the package level. Project parameters are used to supply any external input the project receives to one or more packages in the project. Package parameters allow you to modify package execution without having to edit and redeploy the package.

 

一,Package Parameter

1,在Project Deployment Model下,打开parameters选项卡,New一个Package Parameter,Parameter 名字是ParameterA。

Sensitive:敏感信息,需要加密

Required:必须提供,否则会出错

 

Property

Description

Name

The name of the parameter.

Data type

The data type of the parameter.

Default value

The default value for the parameter assigned at design time. This is also known as the design default.

Sensitive

Sensitive parameter values are encrypted in the catalog and appear as a NULL value when viewed with Transact-SQL or SQL Server Management Studio.

Required

Requires that a value, other than the design default, is specified before the package can execute.

Description

For maintainability, the description of the parameter. In SQL Server Data Tools (SSDT), set the parameter description in the Visual Studio Properties window when the parameter is selected in the applicable parameters window.

 

2,Add parameters to Configurations

 

3,Set Parameter Values After the Project Is Deployed

The Deployment Wizard allows you to set server default parameter values when you deploy your project to the catalog. After your project is in the catalog, you can use SQL Server Management Studio (SSMS) Object Explorer or Transact-SQL to set server default values.

To set server defaults with SSMS Object Explorer:

  1. Select and right-click the project under the Integration Services node.

  2. Click Properties to open the Project Properties dialog window.

  3. Open the parameters page by clicking Parameters under Select a page.

  4. Select the desired parameter in the Parameters list. Note: The Container column helps distinguish project parameters from package parameters.

  5. In the Value column, specify the desired server default parameter value.

To set server defaults with Transact-SQL, use the catalog.set_object_parameter_value (SSISDB Database) stored procedure. To view current server defaults, query the catalog.object_parameters (SSISDB Database) view. To clear a server default value, use the catalog.clear_object_parameter_value (SSISDB Database) stored procedure.

 

MSDN上提供两种方法,一种是使用SSMS来修改,一种是使用TSQL语句来修改

3.1 使用SSMS来修改

选中integration Services Catalogs,右键点击TestISProjects,打开Configure

 

 

点击... 来设置参数的值

 

 

二,Project Parameter

1,在Project视图下,打开Project.params,创建一个project level 的Parameter, 命名为ProjectParameter_A。

2,将Project Parameter 添加到configurations中,

 

 

3,发布到Sql server之后,修改Project parameter的default value。

 

 

 

三,Use of package and project parameters

Parameters are useful for providing runtime values to properties during a package execution. Hence, in a way they replace the concept of configurations that we had for SSIS packages.

Package parameters are useful for providing values to specific package executions. As they are package scope, they would only be available to the package in which they were created.

Project parameters are available to all the packages in a project. They are useful for configuring values which can be shared between packages. For instance if you wanted to have a single parameter containing a server name to be used by multiple packages, then Project Parameters will be useful for you.

You can use a parameter anywhere in an expression by referring it using the following syntax:

@[$<<Project/Package>>::<<ParameterName>>]

The evaluation order is similar to using a variable in an expression and then executing a package. Hence, the value gets evaluated and assigned to the property at Validation phase.

 

 

参考文档:

https://msdn.microsoft.com/en-us/library/hh213214.aspx

https://msdn.microsoft.com/en-us/library/hh213293.aspx

http://blogs.msdn.com/b/mattm/archive/2011/07/16/configuring-projects-and-packages-using-parameters.aspx

 

作者悦光阴
本文版权归作者和博客园所有,欢迎转载,但未经作者同意,必须保留此段声明,且在文章页面醒目位置显示原文连接,否则保留追究法律责任的权利。
分类: SSIS 组件





本文转自悦光阴博客园博客,原文链接:http://www.cnblogs.com/ljhdo/p/4554143.html,如需转载请自行联系原作者
相关实践学习
使用SQL语句管理索引
本次实验主要介绍如何在RDS-SQLServer数据库中,使用SQL语句管理索引。
SQL Server on Linux入门教程
SQL Server数据库一直只提供Windows下的版本。2016年微软宣布推出可运行在Linux系统下的SQL Server数据库,该版本目前还是早期预览版本。本课程主要介绍SQLServer On Linux的基本知识。 相关的阿里云产品:云数据库RDS&nbsp;SQL Server版 RDS SQL Server不仅拥有高可用架构和任意时间点的数据恢复功能,强力支撑各种企业应用,同时也包含了微软的License费用,减少额外支出。 了解产品详情:&nbsp;https://www.aliyun.com/product/rds/sqlserver
目录
相关文章
|
C#
【WPF】CommandParameter解决多传参问题
原文:【WPF】CommandParameter解决多传参问题 方法一:传参按钮控件自身绑定的ItemSource 用WAF框架实现MVVM,按钮的点击事件都要通过Command来传递到这个View对应的ViewModel上,再通过ViewModel传递到上层的Controller层,在Controller层通过DelegateCommand处理按钮真正的事件。
3503 1
|
7月前
CloudStack中@APICommand、@Parameter注解字段解释
CloudStack中@APICommand、@Parameter注解字段解释
|
8月前
|
Java 数据库连接 mybatis
项目移植到原先mybasis项目里出现BindingException: Invalid bound statement (not found): **selectPage
项目移植到原先mybasis项目里出现BindingException: Invalid bound statement (not found): **selectPage
85 1
|
人工智能 Java
getParameter方法的用法
getParameter方法的用法
|
SQL 关系型数据库 MySQL
this is incompatible with sql_mode=only_full_group_by、错误解决方案(亲测可用)
this is incompatible with sql_mode=only_full_group_by、错误解决方案(亲测可用)
4224 0
this is incompatible with sql_mode=only_full_group_by、错误解决方案(亲测可用)
|
SQL Java 数据库连接
HQL查询 HQL Named parameter [xxx] not set 的解决办法
HQL查询 HQL Named parameter [xxx] not set 的解决办法
abap开发function module时使用tables传递参数报错过时的解决方法
如下图,我写了一个Function Module我要在tables中添加一个参数TABLES参数已过时不管怎么点击保存按钮,一直报错,怎么办呢?不管是不是过时,狂点回车,就保存了
1762 0