We’ve deployed the project to a folder in SSIS Catalog, now let’s create Environments and Environment Variables inside the SSIS Catalog:
- Right Click the Environments folder under your Parent SSIS Catalog folder. Select create environment. Give the environment a name. Click OK. I called my first environment Dev.
- On the environment you just created, right click properties. Select the variables tab. Type a name to create a new variable and select a logical datatype. I called mine BikeServer
- Create another environment following the same process. I called mine QA.
- Create an environment variable in the new environment that has the same name and datatype as the environment variable you created in the other environment. So my second environment variable would also be called BikeServer.
Diagram 1 – 3. My two Environments– Dev and QA
Diagram 2. My Environment Variable called BikeServer I gave it the value of the BikeServer on the Dev server which is Dev42. For my QA Environment, I created the same variable, but gave it the value of the QA server, QA42.
So you’ve now got your environments and they each have an environment variable called BikeServer, which has its value properly set. We are going to use the environment variable to change the server name according to which Environment you use. You’ll see in a minute.
To configure the project to use the Environments and the Environment Variables:
- Select the Projects folder. Right click your Project and select Configure
- Select the references page in your project configuration dialog box.
- Click add. Select an environment from “Browse environments window. You can add any or all of the environments you’ve created in the project folder. The diagram shows that I already added Dev and am about to add QA.
Configuring the Project to use the Environments. Start with the References tab to add the Environments
4. Now go to the parameters page. I am using the Environment Variable to control my server name, so I’m going to go to the Connection managers tab inside the Parameters page.
On the Parameters tab. I’m using my BikeServer Environment Variable to change the value of the ServerName in my connection manager.
5. Click the ellipses beside the value you want to configure. In this case, the ellipses beside the ServerName.
6. Click radio button for use environment variable in the Set Parameter value window which comes up. “Set Parameter Value”
7. Select the environment variable you will use, in this case BikeServer. Click OK. Click OK to exit the configure dialog box.
Setting the parameter value.
Configuring the Execution.
Now the ServerName in your connection manager is going to use the value of one of the environment variables you configured. To choose which one, you must configure your execution by doing the following:
1. Right click on your entry point package. Select Run (this is configuring your execution, not running it yet).
2 . When the Run Package dialog box opens, note that you now have to choose an environment, or explicitly supply a value for ServerName, because in the project it has been configured to use an environment variable. We will click the check box by Environment and select Dev. Recall that the value of BikeServer in the Dev Environment was Dev42.
You made me this way, now you have to choose an environment!
3. Click ok. This will start the manual execution of your project. The value of the server name in the connection manager will be DEV42 in this execution, because that is the value of the Environment variable inside the Dev Environment in the SSIS catalog.
Using Agent to schedule jobs with SSIS Catalog projects:
It’s nice that we have a more convenient manual way of executing packages; however, most of the time the goal of packages is to automatically run them on schedules. To achieve this with SQL Server Agent, the SSIS Catalog is now available as a package source when configuring agent jobs.
Agent Package Source
Well kids, thanks for hanging in there through this whole class. The SSIS Catalog is very nifty, but also very different than what we are used to. I hope this post will keep someone from falling in the same holes I did while I was learning.
For more excellent reading on SSIS 2012, please check out Jamie Thomson’s blog posts on the topic. Jamie also has a good set of links to other useful articles on SSIS here. Also check out the official SSIS team blog. Thanks to Matt Masson (T) of that team for his advocacy for SSIS 2012. Matt rocks!
Thanks to Jorge for starting SQLU, and for inviting me to present on a topic I find really exciting. Be sure to check out Audrey’s week next week at SQL U, she’ll be covering Data Modeling.