Reputation: 201
I have tried looking in to Reverse
and CharIndex
but I just can't seem to get it to work.
I have a table with a column full of strings, all of which end with aVALUESa
The VALUES
are a number and vary in length, how do I select these values?
Upvotes: 3
Views: 71
Reputation: 21757
Assuming that your strings always end with the pattern 'aVALUESa' where the 'a' at the start and end is the literal 'a', you can try this:
select reverse(substring(reverse(colname),2,charindex('a',reverse(colname),2)-2))
from yourtable
Upvotes: 1