You should be ordering by actual date (hol_date
) not by converted varchar value.
Assuming hol_id
as Key column
of the table (Not sure why you are using a TOP 1 here), try this query with ORDER BY CASE
as below:
SELECT hol_id ,
CONVERT(VARCHAR(12), hol_date, 112)
FROM holiday
ORDER BY CASE WHEN hol_id = 5
THEN DATEADD(year,100,getdate()) --Assuming 100 years as max
ELSE hol_date
END DESC