sql server - How to change a Date Column into two separate columns -


i have excel file , want extract date , load dimension table month , year only. want through ssis package. example have 6/15/2002 , want take 6/2002 because in dimension table have month , year should do. please me, it's final project
question

how change date column 2 separate columns, month , year

you use derived column transformation that. output excel source remains is. take output through derived column tf, add 2 new columns add new columns, , easiest way convert date string varchar or char (dt_str or dt_wstr based on table schema), based on criteria, using substring function form each new column.

for example: derived column 1, <add new column>, substring( (dt_str, 20, 1252)your_column , 0, 1 ) + substring( (dt_str, 20, 1252)your_column , 6, 4 ) request

updated

(dt_wstr, 20)month(your_column)+ "/" + (dt_wstr, 20)year(your_column) 

updated 2nd before, derived column 1, <add new column>, (dt_wstr, 20)month(your_column) month expression.

derived column 2, <add new column>, (dt_wstr, 20)year(your_column) year expression.

you rename derived column 1 or derived column 2 name want later identification.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -