Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Need to convert date into string literal in SSIS Expand / Collapse
Author
Message
Posted Wednesday, February 27, 2013 1:55 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Thursday, July 17, 2014 12:46 PM
Points: 91, Visits: 143
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
Post #1424738
Posted Wednesday, February 27, 2013 3:00 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 11:17 AM
Points: 1,184, Visits: 1,220
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.000
Output-07012013
Please guide me in achieving this in SSIS.
Thanks in advance


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
Post #1424778
Posted Wednesday, February 27, 2013 3:45 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Yesterday @ 1:52 PM
Points: 504, Visits: 1,870
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)

Post #1424799
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse