• balajisrm (9/15/2012)


    But this one is not working for SELECT CONVERT(CHAR(6), '2012-09-15', 112);

    i mean When we provide a hard coded date.

    As mentioned, you need to convert that string to a date first.

    But, even better yet, follow the practice of hard-coding dates following the ISO standard. YYYYMMDD, without hyphens. That avoids issues with localization and conversion.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon