Solved

substring and charindex

Posted on 2009-05-13
2
426 Views
Last Modified: 2012-08-23
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
Comment
Question by:marshaklana
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 24378886
this will do:
select reverse(  left(    reverse(yourfield) , charindex('\', reverse(yourfield))-1)) from yourtable

Open in new window

0
 

Expert Comment

by:czlong
ID: 38326321
What if we want to get "personal3$", how would that be done?
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question