Can anyone think of a reason to do this:
SELECT * FROM TableA ORDER BY cast(cast(RealColumnA as nvarchar(50))as float) –where RealColumnA is defined as real in the table
A former developer of mine insisted this was necessary to get reals to sort correctly. Can anyone think of a reason that may be true?
The cast in the orderby clause is a big performance killer. But I need to be sure it is not necessary before I remove it.
Remove it. ORDER BY is what you expect it to be. And it certainly would be a performance killer.
Rule #1 about SQL. Question (and test) all your (and other peoples’) assumptions. (Especially weird ones like this.)