Link to home
Start Free TrialLog in
Avatar of jnordeng
jnordeng

asked on

Skip a letter in the alphabet in SQL query

Hi I was asked to come up with code to convert letters of the alphabet to months of the year which I did no problem. But then they  came back to me and said I needed to skip the letter "I"  in the process. I am stumped. If anyone can help I would sure appreciate it.

Data is 7115A12345. "A" is the month in this serial number that we want to convert to the month number but we need to skip "I" in the process

(ASCII(SUBSTRING(serial_number,5,1))- ASCII('A') + 1)  as [MONTH]
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

CHARINDEX(SUBSTRING(serial_number,5,1), 'ABCDEFGHJKLM') AS [MONTH]
ASKER CERTIFIED SOLUTION
Avatar of Rich Weissler
Rich Weissler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial