Scenario:In this post we will learn how to convert Week Day Number (1,2,3,4,5,6,7) to Day name ( Monday,Tuesday, Wednesday,Thursday,Friday,Saturday and Sunday) by using Script Component.
Solution:Let's say we are getting data in flat file that has week Day numbers and we need to convert o Day Name before we insert into our destination. We can use expressions in Derived Column Transformation or we can use Script Component to do that. In this example we are going to use Script Component.
Step 1:Create an SSIS Package. Bring the Data Flow Task to Control Flow Pane and then bring Flat File Source and create connection to Flat File Source. If you are extracting data from Database you don't need to use Script Component. You can always use SQL Query to convert it to required format and then process it and load to destination. As we are reading the data from Flat File, we can not write SQL query so we have to use Derived Column Transformation or Script Component.
Add a new output column with DayName of data type string (DT_STR).
Add connection manager in Script Component as shown below.