Expression --need 2 digit not 4

  • 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"

    Displays

    capp20080124.txt

    What I want is capp080124.txt and I not sure how to get the year to be two digits and not four? Please help..

  • Replace

    (DT_STR,4,1252) DatePart("yy",getdate())

    with

    Right((DT_STR, 4, 1252)DatePart("yyyy", getdate()), 2)

    This will return the last two (Right) digits of the year (ignoring the "20" century).

  • alane 46264 (11/15/2013)


    Replace

    (DT_STR,4,1252) DatePart("yy",getdate())

    with

    Right((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! 😀

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply