Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 Expression --need 2 digit not 4 Rate Topic Display Mode Topic Options
Author
 Message
 Posted Thursday, January 24, 2008 3:01 PM
 Grasshopper Group: General Forum Members Last Login: Thursday, December 1, 2016 2:28 PM Points: 18, Visits: 594
 I am trying to create an expression in ssis as follows:"capp"+(DT_STR,4,1252) DatePart("yy",getdate()) +Right("0" + (DT_STR,2,1252) DatePart("m",getdate()),2) +Right("0" + (DT_STR,2,1252) DatePart("d",getdate()),2) + ".txt"Displayscapp20080124.txtWhat I want is capp080124.txt and I not sure how to get the year to be two digits and not four? Please help..
Post #447214
 Posted Friday, November 15, 2013 2:44 PM
 Forum Newbie Group: General Forum Members Last Login: Monday, December 9, 2013 7:49 AM Points: 1, Visits: 23
 Replace(DT_STR,4,1252) DatePart("yy",getdate())withRight((DT_STR, 4, 1252)DatePart("yyyy", getdate()), 2)This will return the last two (Right) digits of the year (ignoring the "20" century).
Post #1514868
 Posted Monday, November 18, 2013 5:11 AM
 SSCertifiable Group: General Forum Members Last Login: Yesterday @ 7:23 PM Points: 7,951, Visits: 19,049
 alane 46264 (11/15/2013)Replace(DT_STR,4,1252) DatePart("yy",getdate())withRight((DT_STR, 4, 1252)DatePart("yyyy", getdate()), 2)This will return the last two (Right) digits of the year (ignoring the "20" century).You just answered a five-year-old post - hope that they were not sitting there waiting! Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.Just when you think your code is idiot-proof, the world invents a better idiot.
Post #1515184

 Permissions