I want to remove all the letters before numbers in the below strings:
BIO105L BIO106 BIO106L BIO201
I want the letters after the number to stay and not trimmed.
I tried to do this:
select right(s.EVENT_ID, len(s.EVENTID) - charindex('%[^0-9]%', s.EVENT_ID))
from EVENTS s
Can someone help?
CodePudding user response:
You are likely looking for PATINDEX as you are searching for a pattern:
SELECT RIGHT(s.EVENT_ID, LEN(s.EVENT_ID) - PATINDEX('%[0-9]%', s.EVENT_ID) 1) FROM EVENTS s