SSIS has many transformations tasks and Derived column is one of them. This is used to derive a new columns by using any of the following.
- Constants or static values
- Other columns
- Variable values
This is powerful because we can generate new column run time and can make use of the same. Lets see couple of examples in this post where we can use DERIVED COLUMN transformation.
We are gonna create a table with the columns Name, Salary and Bonus and we will use our SSIS package to generate a new file which will have derived field Gross salary(Sum of Salary and Bonus) and also display the name field in UPPER CASE. PFB the steps followed.
- First create a table and insert data into it as show below.
- Open a new project and drag a Data Flow task from toolbox in Control Flow.
- Edit the Data Flow task by double clicking the object or by selecting EDIT button on Right click on the object. Make sure the Data Flow Page is opened as shown below.
- Select OLE DB data source from data flow sources and drag and drop it in the data flow.
- Double click on the OLE DB data source to open a new window where we can set the properties of the connection.
- Select the connection manager and click on new button to set the connection string as shown below.
- Drag and drop Derived Column Transformation in to the Data Flow Pane and provide the connection between OLE DB Source and Derived column Transformation and open the properties pane by simply double clicking Derived Column transformation.
- In the Derived Column Transformation Editor expand the columns folder and drag and drop Column 1 as shown below.
- Use the function UPPER to convert the data of the desired column to UPPER CASE as shown above. This is as simple as this to add a new column which converts data of a column to UPPER CASE.
- Now set the destination as explained in the post here. Once destination is set the Execute the Package.
This is it Guys ! Hope you understood the concepts. Happy Coding !!
Roopesh Babu V