Need Year & the Month of a Date Field Formated as 'YYYYMM'

  • Eugene Elutin (3/13/2012)


    Can someone explain why everyone suggesting huge concatenation logic when date in YYYYMMDD format can be produced as a simple convert with option 112 for ISO?

    Don't know. Perhaps because there are several ways to accomplish it and some of us just didn't look at it. All I tried to eliminate was the need for the case statements. Using convert and the 112 option would be simpler.

  • Lynn Pettis (3/13/2012)


    Eugene Elutin (3/13/2012)


    Can someone explain why everyone suggesting huge concatenation logic when date in YYYYMMDD format can be produced as a simple convert with option 112 for ISO?

    Don't know. Perhaps because there are several ways to accomplish it and some of us just didn't look at it. All I tried to eliminate was the need for the case statements. Using convert and the 112 option would be simpler.

    OK, Gosh! I thought I was missing something... :w00t:

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • Eugene Elutin (3/13/2012)


    Lynn Pettis (3/13/2012)


    Eugene Elutin (3/13/2012)


    Can someone explain why everyone suggesting huge concatenation logic when date in YYYYMMDD format can be produced as a simple convert with option 112 for ISO?

    Don't know. Perhaps because there are several ways to accomplish it and some of us just didn't look at it. All I tried to eliminate was the need for the case statements. Using convert and the 112 option would be simpler.

    OK, Gosh! I thought I was missing something... :w00t:

    That is what makes this site so good. Different ways of doing things and getting to see them. Now, just need to remember them (short term memory isn't what it used to be). 😉

  • Thanks for all of the help. 😎

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Viewing 4 posts - 16 through 19 (of 19 total)

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