tags:

views:

40

answers:

1

This is my SSIS excerise

I have a DATETIME column, what I want is to get the Month and Year from " DATETIME " column and load it into a new column called “Month_Year” and then get day from the same " DATETIME " and load it into a new column called "day"

Visually

  1. Source Column:

DATETIME

  1. Destination Column:

Month_Year Day

Bottom line is I need to break DATETIME into two column Month_Year and Day.

A: 

Simple, first create a Derived Column component in your flow task. Then, in the component, create a new column, call it MONTH_YEAR and in the Expression field type: (DT_WSTR, 10)DATEPART(month, [YOUR_DATETIME_COLUMN]) + "_" + (DT_WSTR, 4)DATEPART(year, [YOUR_DATETIME_COLUMN])

Then for the day piece do the same thing only creating a new column called DAY and pull the day piece out from DATEPART(..).

Since you created those as new columns you can then use them in the data flow as wished.

ajdams