SELECT * FROM TableName WHERE ORDER BY CASE @OrderByColumn WHEN 1 THEN Forename WHEN 2 THEN Surname END;
I have a statement like a
You need to split your ORDER BY in two parts:
ORDER BY
SELECT * FROM TableName WHERE ORDER BY (CASE @OrderByColumn WHEN 1 THEN Forename END) DESC -- Forename --> descending , (CASE @OrderByColumn WHEN 2 THEN Surname END) ASC -- Surname --> ascending