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
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Derived Column: adding calculated columns


Creating customized columns is among the most common requirements in the ETL. The Derived Column Transform provides a way to write custom expressions in order to create new columns or replace existing columns. The customization of generated columns is based on expressions.

In this recipe we will get a list of employees from the EmployeeDepartmentHistory table. We have two columns that serve as sources: StartDate and EndDate. We will fetch a value for the YearsInCompany field by subtracting the StartDate year from the EndDate year; and if EndDate is Null, then subtracting the StartDate from the current date.

Getting ready

Create a new empty file. Name it R01_Destination.csv in the C:\SSIS\Ch03_Data Flow Task-Part 2-Transformations\Files directory, then save it with utf-8 encoding. We will use this file as our destination. Select the package created by default and rename it to "P01_DerivedColumn.dtsx

How to do it...

  1. Create a new Integration Services type...