Book Image

Microsoft SQL Server 2012 Integration Services: An Expert Cookbook

Book Image

Microsoft SQL Server 2012 Integration Services: An Expert Cookbook

Overview of this book

SQL Server Integration Services (SSIS) is a leading tool in the data warehouse industry - used for performing extraction, transformation, and load operations. This book is aligned with the most common methodology associated with SSIS known as Extract Transform and Load (ETL); ETL is responsible for the extraction of data from several sources, their cleansing, customization, and loading into a central repository normally called Data Warehouse or Data Mart.Microsoft SQL Server 2012 Integration Services: An Expert Cookbook covers all the aspects of SSIS 2012 with lots of real-world scenarios to help readers understand usages of SSIS in every environment. Written by two SQL Server MVPs who have in-depth knowledge of SSIS having worked with it for many years.This book starts by creating simple data transfer packages with wizards and illustrates how to create more complex data transfer packages, troubleshoot packages, make robust SSIS packages, and how to boost the performance of data consolidation with SSIS. It then covers data flow transformations and advanced transformations for data cleansing, fuzzy and term extraction in detail. The book then dives deep into making a dynamic package with the help of expressions and variables, and performance tuning and consideration.
Table of Contents (23 chapters)
Microsoft SQL Server 2012 Integration Services: An Expert Cookbook
About the Authors
About the Reviewers

The Script Component as a Transformation

Writing scripts in Data Flow is another major aspect of scripting in SSIS. The Script Component is one of the most powerful components in SSIS Data Flow and is usable as Source, Transformation, and Destination.

In this recipe, we will use a Transformation Script Component to create a row number, besides other columns in the data stream, because there is no Row Number Transformation in SSIS Toolbox.

How to do it...

  1. Create an SSIS project and name it R02_ScriptComponent as Transformation.

  2. Add a Data Flow Task from the SSIS Toolbox and go to the Data Flow tab.

  3. Add an OLE DB Source, create a Connection to the AdventureWorks2012 database, and set the Data Access Mode as Table or View, and choose HumanResources.Department as your source table.

  4. Connect a Data Path from OLE DB Source to Script Component and go to the Script Transformation Editor.

  5. Set the Script Language as Visual C# 2010.

  6. Go to the Inputs and Outputs tab and expand Output 0, then under Output Columns...