In one of my queries, I was trying to sort by a column that had a varchar
data type.
I wanted to show columns that had a space after the columns that had empty strings, but the output of ORDER BY
did not work as I expected it to (in fact it surprised me).
Here is a SQL FIDDLE that shows the problem.
I have researched this issue and the only partially relevant article I found is this.
What I want to know is why would SQL Server do this, and what can I do to force the sorting to consider these values as different?
Thanks in advance.