469,133 Members | 1,003 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,133 developers. It's quick & easy.

Substring after character /

4
Hi,

If have the following data:


AB1/SmithJ
Wealth/PerryL
Coms/JonesF
Z11/DollarsT
etc...

How would I be able to substring this data so I get output as follows?
SmithJ
PerryL
JonesF
DollarsT

The number of characters before the / can vary and so can the number of characters after the /...

Thank you for your help.
Dec 11 '07 #1
1 24477
jamesd0142
469 256MB
only thing i can suggest is that you edit the current fields to contain a character at the end also and use this code

Expand|Select|Wrap|Line Numbers
  1. select 
  2. SUBSTRING([<columnname>],CHARINDEX('/',<columnname>),CHARINDEX('\',[<columnname>])) as col01
  3. from <tablenName>
  4.  
the record would need and ending '\' also.

to do that:
Expand|Select|Wrap|Line Numbers
  1. update <tablename>
  2. set <fieldname> = <fieldname> + '\'
  3.  
Dec 11 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by sysindex | last post: by
reply views Thread by Gazi Mahmud | last post: by
6 posts views Thread by becte | last post: by
2 posts views Thread by David Filion | last post: by
2 posts views Thread by Sharkie | last post: by
3 posts views Thread by balakrishnan.dinesh | last post: by
4 posts views Thread by Jean-Guy Mouton | last post: by
3 posts views Thread by =?Utf-8?B?anAybXNmdA==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.