Maybe its the way its inserting the dates, but all three methods of sorting all put jun 1st in between april and may...
maybe the governments up to somethin here?
any rules on getting this sorting the right way using convert to a varchar?
maybe the governments up to somethin here?
any rules on getting this sorting the right way using convert to a varchar?
Code:
DECLARE @stop int,@sql varchar(800)
--DROP TABLE #dateSort
CREATE TABLE #dateSort
(date1 varchar(50),date2 varchar(50),date3 varchar(50))
SET @stop = 0
WHILE @stop < 10
BEGIN
INSERT INTO #dateSort
SELECT getDate()+(5 * @stop),
getDate()+(5 * @stop),
getDate()+(5 * @stop)
SET @stop = @stop + 1
END
SELECT * FROM #dateSort
ORDER BY CONVERT(varchar(10),date1,101)
SELECT * FROM #dateSort
ORDER BY CONVERT(varchar(10),date2,102)
SELECT * FROM #dateSort
ORDER BY CONVERT(varchar(10),date3,120)
SELECT * FROM #dateSort