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

    Because that is not a hard-coded date. It is a hard-coded string defined as CHAR(10) being converted to another string defined as CHAR(6).

    Modify it to this:

    SELECT convert(char(6), cast('2012-09-15' As date), 112);

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs