What do you mean by "append the sanitized column name to sort by before executing it"? The data type returned from the CASE statement is what this tip/trick is about, and I don't see anything in your alternate that addresses this (though looks like you also noticed the bug in the OP's code in which the SQL will not run without having the fields in the first SELECT having names).
Last Visit: 31-Dec-99 18:00 Last Update: 14-Jun-24 12:49