• stevenb 14609 (9/2/2015)


    You have converted the date to a VARCHAR, so now it's sorting alphabetically instead of by date. In other words, alphabetically would be 1, 11, 12, 2, 3 ...

    Easy solution is to convert your varchar field back to a date, so it would be something like

    CAST(CONVERT(VARCHAR,MyDateField,103) AS DATE)

    or

    Just do a straight conversion to DATE, since the DATE datatype doesn't have the time portion of the DATETIME datatype.

    Thanks for getting back - educational re VARCHAR, I won't make that error again.