SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Need to convert date into string literal in SSIS


Need to convert date into string literal in SSIS

Author
Message
manibad
manibad
SSC Eights!
SSC Eights! (807 reputation)SSC Eights! (807 reputation)SSC Eights! (807 reputation)SSC Eights! (807 reputation)SSC Eights! (807 reputation)SSC Eights! (807 reputation)SSC Eights! (807 reputation)SSC Eights! (807 reputation)

Group: General Forum Members
Points: 807 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
Rob Taylor
Rob Taylor
SSCrazy Eights
SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)SSCrazy Eights (8.1K reputation)

Group: General Forum Members
Points: 8120 Visits: 1664
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
kl25
kl25
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2268 Visits: 1875
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)


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search