Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 438
  • Last Modified:

substring and charindex

Experts! I need to get a substring from right to left intil the first charindex '\'. Example:
'\\cdw22\personal3$\JMARTINEZ3', will look like this: 'JMARTINEZ3'. LEN of characters are not fixed. Thanks!
0
marshaklana
Asked:
marshaklana
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
this will do:
select reverse(  left(    reverse(yourfield) , charindex('\', reverse(yourfield))-1)) from yourtable

Open in new window

0
 
czlongCommented:
What if we want to get "personal3$", how would that be done?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now