Is there a preferred way to order a varchar column numerically (for those
that are numeric), then alphanumericall y for all others?
I've tried:
ORDER BY CASE WHEN IsNumeric(<colu mn_name>) = 1 THEN CONVERT(Float,
<column_name> ) ELSE 999999999 END;
and
ORDER BY CASE WHEN IsNumeric(<colu mn_name>) = 1 THEN 0 ELSE 1 END, CASE WHEN
IsNumeric(<colu mn_name>) = 1 THEN CONVERT(Float, <column_name> ) ELSE 999999
END, <column_name> ;
Neither of these however give the desired results.
Any ideas?
Thanks,
Frank
that are numeric), then alphanumericall y for all others?
I've tried:
ORDER BY CASE WHEN IsNumeric(<colu mn_name>) = 1 THEN CONVERT(Float,
<column_name> ) ELSE 999999999 END;
and
ORDER BY CASE WHEN IsNumeric(<colu mn_name>) = 1 THEN 0 ELSE 1 END, CASE WHEN
IsNumeric(<colu mn_name>) = 1 THEN CONVERT(Float, <column_name> ) ELSE 999999
END, <column_name> ;
Neither of these however give the desired results.
Any ideas?
Thanks,
Frank
Comment