• ScottPletcher (2/18/2013)


    Jeff Moden (2/18/2013)


    ScottPletcher (2/18/2013)


    declare @enddate datetime

    set @enddate = getdate()

    SELECT STUFF(CONVERT(varchar(10), DATEADD(DAY, -21, @enddate), 1), 3, 4, '')

    Except for Sean, we did forget to answer the original question. :blush: Thanks, Scott.

    Huh?? I thought that was the original q: display 21 days before [@]enddate in format mm/yy.

    It was and my comment was meant to be a compliment to you.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)