SQL - Sort order of string with numbers in
Posted on 2011-03-03
I have a table with a list of parts with codes like:-
I want to be able to sort these in the order above - a string field will sort the 100 before the 99.
It is possible that the format of these code may change i.e. could be 2 alpha characters in the code.
I thought there may be a way to convert the letters to a 2 digit number 01 - 26 and replace them so I get a number to sort on. In this way all similar codes would be in the right order?
Appreciate any ideas on this.