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...
Create an SSIS project and name it
R02_ScriptComponent as
Transformation
.Add a Data Flow Task from the SSIS Toolbox and go to the Data Flow tab.
Add an OLE DB Source, create a Connection to the
AdventureWorks2012
database, and set the Data Access Mode as Table or View, and chooseHumanResources.Department
as your source table.Connect a Data Path from OLE DB Source to Script Component and go to the Script Transformation Editor.
Set the Script Language as Visual C# 2010.
Go to the Inputs and Outputs tab and expand Output 0, then under Output Columns...