I want to remove the substring before last occurrence of period(.)
. The Query should convert r.k.Lee Brown
to Lee Brown
. So, basically I need the substring before last dot .
and replace it with ''
.
Try this:
SELECT RIGHT(@str, CHARINDEX('.', REVERSE(@str)) - 1)
You can slightly modify the above using:
REVERSE('.' + @str))
instead of
REVERSE(@str)
just in case there are no '.'
in @str
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With