Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microsoft SQL Server 2012 Integration Services: An Expert Cookbook

You're reading from   Microsoft SQL Server 2012 Integration Services: An Expert Cookbook Over 80 expert recipes to design, create, and deploy SSIS packages with this book and ebook

Arrow left icon
Product type Paperback
Published in May 2012
Publisher Packt
ISBN-13 9781849685245
Length 564 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Toc

Table of Contents (23) Chapters Close

Microsoft SQL Server 2012 Integration Services: An Expert Cookbook
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started with SQL Server Integration Services 2. Control Flow Tasks FREE CHAPTER 3. Data Flow Task Part 1—Extract and Load 4. Data Flow Task Part 2—Transformations 5. Data Flow Task Part 3—Advanced Transformation 6. Variables, Expressions, and Dynamism in SSIS 7. Containers and Precedence Constraints 8. Scripting 9. Deployment 10. Debugging, Troubleshooting, and Migrating Packages to 2012 11. Event Handling and Logging 12. Execution 13. Restartability and Robustness 14. Programming SSIS 15. Performance Boost in SSIS Index

Creating the first SSIS Package


After understanding the SSDT environment, you will be able to make your first SSIS Package. Depending on the Data Integration project's complexity, it's always recommended to think carefully while selecting tasks and components to apply, as well as the order in which to execute them.

In this recipe, the first package created will read the number of records in an Adventure Works Microsoft Sample table and store it inside the SSIS Package.

Getting ready

You can reuse the recipe created in the previous section (adding a new package to it), or start from scratch as explained in the following steps:

  1. Open SQL Server Data Tools (SSDT).

  2. Click on New Project… and a Windows dialog will appear.

  3. Click on the Business Intelligence Projects tab and under the Installed Templates section, select Integration Services Project.

  4. Provide a name and location for the SSIS project and an empty structure as well as a package will be created.

  5. In the Solution Explorer, select the empty package.dtsx and rename it to: P01_FirstSSISPackage.dtsx.

How to do it...

Now that the SSIS project is created, ensure that the empty package created by default is open and follow these steps:

  1. Create an OLEDB Connection to the Adventure Works Microsoft sample database at the package level. (As already mentioned, if you create this connection in the Solution Explorer window, the connection will be created at the project level and will be automatically included inside all the existent packages).

  2. In the Configure OLE DB Connection Manager Editor, select New... to create a new connection. If the connection already exists in the Data Connections list then select it here.

    Tip

    Ensure that the Control Flow tab is selected in the Package Designer area.

  3. Drag-and-drop Execute SQL Task from SSIS Toolbox and place into the control flow design surface.

  4. Double-click to edit Execute SQL Task or right-click and click on the Edit option.

  5. Set the Connection property of the task to the connection created in step two.

  6. Set the Result set to Single row.

  7. Add the SQL Statement: SELECT COUNT(*) AS NR_ROWS FROM SalesLT.Customer to get the number of records from the Customer table.

  8. Drag-and-drop Script Task from SSIS Toolbox and place into the Package Designer area and edit it by double-clicking on it.

  9. Create a new variable to store the value provided by the previous task and add a message box inside the script (the script task is explained more clearly in Chapter 11, Event Handling and Logging) as follows:

    MsgBox (Dts.Variables(0).Value, MsgBoxStyle.Information)
  10. Run the package by pressing F5.

How it works...

This recipe created a basic SSIS Package that included the most used tasks among SSIS projects: the Execute SQL Task, to communicate with a database through SQL queries and the Script Task that allows us to create some custom "work" when other tasks fall short. Naturally, it is too early to go into details with these two tasks, but this way it's possible to have an initial look at these common tasks.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image