I have a table 'MyTable' with the following the column, ID varchar(50).
ID
----------
10
100
700-6 0110B512
700-6 0110B513
700-8 0110B512
700-9 0110B512
I need to sort this column with the output
ID
----------
10
100
700-6 0110B512
700-8 0110B512
700-9 0110B512
700-6 0110B513
Please help!!
I have tried like this but the output is not as desired.
SELECT * FROM MyTable
ORDER BY
Case
When IsNumeric(ID) = 1 then LEFT(Replicate('0',101) + ID, 100)
When IsNumeric(ID) = 0 then RIGHT(Replicate('0',101) + ID, 100)
Else ID
END
ASC