I have a VarChar
column in SQL Server in which I am storing mostly numbers but there are also some strings. I wanted to use
Select column1
from table
Order by Column1 Asc
but it sorts the numbers in this order instead
1
10
11
12
19
2
3
4
5
String1
String2
...
I have searched for a way to do this online and the recommended method was to cast as INT or do:
Select column1
from table
Order by Column1 + 0 Asc
However, those solutions does not work for me because I have strings in my column and I get the error:
Conversion failed when converting the varchar value 'Damage' to data type int.