February 12, 2008 at 7:11 am
Guys,
I have names in the following format, is there any way to strip the name and grab caaXXXXX from the name. I have tried substring but could develop the logic to grab the text after last place holder
caaxxxxx always occurs after the last place holder '_'
John_l_smith_caa12000
mike_caa12001
Mark_m_andrew_levey_caa12002
Any suggestions inputs would help.
Thanks
February 12, 2008 at 7:24 am
HI,
Try this:
SELECT RIGHT([MyVarchar],CHARINDEX('_',REVERSE([MyVarchar]))-1)
Thanks
Chris
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply