Tuesday, September 21, 2010

Saving and Running Packages


Once created a SSIS package, you're probably ready to run it and see what it does. But first, let's look at the options for saving SSIS packages. When you work in BIDS, your SSIS package is saved as an XML file (with the extension dtsx) directly in the normal Windows file system. But that's not the only option. Packages can also be saved in the msdb database in SQL Server itself, or in a special area of the file system called the Package Store.
Storing SSIS packages in the Package Store or the msdb database makes it easier to access and manage them from SQL Server's administrative and command-line tools without needing to have any knowledge of the physical layout of the server's hard drive.
Saving Packages to Alternate Locations
To save a package to the msdb database or the Package Store, you use the File > Save Package As menu item within BIDS.

To store copies of the package you've developed, follow these steps.
  1. Select File > Save Copy of Package.dtsx As from the BIDS menus.
  2. Select SSIS Package Store as the Package Location.
  3. Select the name of your test server.
  4. Enter the package path.
  5. Click OK.
  6. Select File > Save Copy of Package.dtsx As from the BIDS menus.
  7. Select SQL Server as the Package Location.
  8. Select the name of your test server and fill in your authentication information.
  9. Enter ExportDepartments as the package path.
  10. Click OK.
Running a Package
You can run the final package from either BIDS or SQL Server Management Studio. When you're developing a package, it's convenient to run it directly from BIDS. When the package has been deployed to a production server (and saved to the msdb database or the Package Store) you'll probably want to run it from SQL Server Management Studio.
SQL Server also includes a command-line utility, dtsexec, that lets you run packages from batch files.
Running a Package from BIDS
With the package open in BIDS, you can run it using the standard Visual Studio tools for running a project. Choose any of these options:
  • Right-click the package in Solution Explorer and select Execute Package.
  • Click the Start Debugging toolbar button.
  • Press F5.
To run the package that you have loaded in BIDS, follow these steps:

  1. Click the Start Debugging toolbar button. SSIS will execute the package, highlighting the steps in the package as they are completed. You can select any tab to watch what's going on. For example, if you select the Control Flow tab, you'll see tasks highlighted, as shown in Figure. 

     2. When the package finishes executing, click the hyperlink underneath the Connection    Managers pane to stop the debugger.
    3. Click the Execution Results tab to see detailed information on the package, as shown in Figure.

All of the events you see in the Execution Results pane are things that you can create event handlers to react to within the package. As you can see, DTS issues a quite a number of events, from progress events to warnings about extra columns of data that we retrieved but never used.
Running a Package from SQL Server Management Studio
To run a package from SQL Server Management Studio, you need to connect Object Browser to SSIS.
Try It!
  1. In SQL Server Management Studio, click the Connect button at the top of the Object Explorer window.
  2. Select Integration Services.
  3. Choose the server with Integration Services installed and click Connect. This will add an Integration Services node at the bottom of Object Explorer.
  4. Expand the Stored Packages node. You'll see that you can drill down into the File System node to find packages in the Package Store, or the MSDB node to find packages stored in the msdb database.
  5. Expand the File System node.
  6. Right-click on the package and select Run Package. This will open the Execute Package utility, shown in Figure .



  1. Click Execute.
  2. Click Close twice to dismiss the progress dialog box and the Execute Package Utility.
  3. Browse for the inserted data
  1. Click the Execute toolbar button to verify that the package was run. You should see one entry for when the package was run from BIDS and one from when you ran it from SQL Server Management Studio.