manibad
SSCommitted
Points: 1556
More actions
February 27, 2013 at 1:55 pm
#147968
I need to convert date into string literal in SSIS in derived column.How is it possible.
Example:
Input-2013-01-07 00:00:00.000
Output-07012013
Please guide me in achieving this in SSIS.
Thanks in advance
robert.gerald.taylor
SSChampion
Points: 13133
February 27, 2013 at 3:00 pm
#1591759
manibad (2/27/2013)I need to convert date into string literal in SSIS in derived column.How is it possible.Example:Input-2013-01-07 00:00:00.000Output-07012013Please guide me in achieving this in SSIS.Thanks in advance
manibad (2/27/2013)
Just off the top of my head, try an expression like:
RIGHT("0" + (DT_WSTR,2)DAY(GETDATE(),2) + RIGHT("0" + (DT_WSTR,2)MONTH(GETDATE(),2) + (DT_WSTR, 4)YEAR(GETDATE())
HTH,
Rob
kl25
Hall of Fame
Points: 3752
February 27, 2013 at 3:45 pm
#1591780
Here's another option:
SUBSTRING((DT_WSTR,10)(DT_DBDATE)GETDATE(),6,2) + SUBSTRING((DT_WSTR,10)(DT_DBDATE)GETDATE(),9,2) + SUBSTRING((DT_WSTR,10)(DT_DBDATE)GETDATE(),1,4)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply