CAST Statement - Month Conversion

  • select convert(varchar(2), getdate(), 1)

  • Michael Valentine Jones (3/11/2009)


    Shorter.

    select [Month] = right(100+month(getdate()),2)

    Results:

    Month

    -----

    03

    I like that one! The use of of 100 is clever.

    I used something like RIGHT('00' + CONVERT(varchar(2), month(getdate()), 2)

Viewing 2 posts - 16 through 16 (of 16 total)

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