I have some string values already populated in a nvarchar column. the format of the strings are like this:
For example: 16B, 23G, 128F, 128M etc...
I need to find out the maximum value from these, then generate the next one from code. The logic for picking up the maximum item is like the following:
- Pick up the string with the largest number.
- If multiple largest number, then pick up the string the largest alphabet among those.
For example, the largest string from the above series is 128M.
Now I need to generate the next sequence. the next string will have
- The same number as the largest one, but alphabet incremented by 1. I.E. 128N
- If the alphabet reaches to Z, then the number gets incremented by 1, and alphabet is A. for example, the next String of 128Z is 129A.
Can anyone let me know what kind of SQL can get me the desired string.