Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSIS Variables vs Parameters (SSIS Denali)

Tags:

ssis

  1. What is the difference between Variables and Parameters in SSIS Denali?
  2. If there is any difference then What is that which Variables cannot do that Parameters can do ? or vice versa.
  3. When should one go with SSIS Parameters and Variables?

I tried searching on Google, but I failed to get some information.

Thanks In Anticipation!

like image 994
Harshad Avatar asked Mar 11 '13 11:03

Harshad


People also ask

What is the difference between parameters and variables in SSIS?

Parameters are using send data from outside of the package like usernames, passwords or connectionstrings etc. Variables are using inside of the package. It means you can define a variable in one of your SSIS package and use it in package level.

What is the difference between variables and parameters?

There is a clear difference between variables and parameters. A variable represents a model state, and may change during simulation. A parameter is commonly used to describe objects statically. A parameter is normally a constant in a single simulation, and is changed only when you need to adjust your model behavior.

What is parameters in SSIS?

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.

How many types of parameters are there in SSIS?

There are three types of parameters that can be used within an Execute SQL Task in SSIS: Input parameters: used to pass a value as a parameter within a SQL command or stored procedure. Output parameters: used to store a value generated from an SQL command or stored procedure.


2 Answers

I think a little bit background will be beneficial to understand the Parameter concept. Here I will explain it in the context of comparing with Variables. To fully grasp the Parameter concept, you might need to look up for the new Project Deployment Model, Environment, Build Configuration as well..

Usage Of Variable

With SSIS prior 2012, if we need to pass any external values to the package before the execution (as we all do all the time), I normally use configuration file (or a couple of other ways). Say we have a file server, which will be used to access a shared file, I will use variable to store the server name, and expose this variable to the configuration file. If the actual file server is changed (dev env to test env etc.), we just need the change the value of that variable in the configuration file and SSIS package remains intact.

Everything looked good, but there are a couple of things that I always ask myself why and could not figure out why:

  1. 100% of the time when I am exposing variables to configuration file, I just expose the "Value" properties. Why does SSIS allow to expose all the other variable properties?

  2. Why does SSIS not have "private" variable? By "private" I mean when I chose the variables to configure, the "private" ones just did not get shown on the pick list. The SSIS package could have dozens of variables, for the internal value-holders, what's the point to expose them? Why I have to scroll all the way to find the only one I need to expose?

New Project Deployment Model

SSIS 2012 introduces a new deployment model, Project Deployment Model. For short, this model deploys SSIS project as a single unit to SQL Server SSIS catalog, and package configuration is NOT available in this model (it is available in the old model referenced as Package Deployment Model, with SSIS 2012 you can choose which one to use, 2012 default to the new model).

If we want the pass some values into the SSIS packages, we have to pass them in via Parameters, and use SSIS catalog in SSMS to configure the value for the parameters(only the value, nothing else we can configure). Parameters and connection managers are exposed automatically in SSIS catalog which can be configured, nothing else previously available via configuration files can be configured in Project Deployment Model (The world is much cleaner). Inside SSIS package, parameters can be used in the same way as variables in terms of building up expressions. However, parameters can NOT be modified within the SSIS package, which makes perfect sense. (Why do we need to change a value which is passed in from external? If we have to, pass the value to an variable, and do the changes there..)

Sum Up

Parameter is only available in the Project Deployment Model, and it provides the only mechanism for passing values from external to SSIS packages in this model. If we think SSIS pacakge as an OO class, Parameters could be thought as public properties, which externals can access and assign value to it (the class itself can/will use it, but cannot modify it). Where Variables could be thought as private variables, which are used internally, external world does not need to know anything about it.

For the old Package Deployment model, there is no Parameter, and the world remains the same.

like image 175
Jian Fu Avatar answered Oct 06 '22 21:10

Jian Fu


FYI, in short, variable's value can be changed during the runtime, but parameter cannot. Parameter can help you do the project deployment and you can set it up in SSISDB catalog, while variable cannot.

like image 43
Dance-Henry Avatar answered Oct 06 '22 20:10

Dance-Henry