Solved

Access query to extract data

Posted on 2009-07-01
3
208 Views
Last Modified: 2012-05-07
Hi!  I need to extract from the WBS to the  next "_".  Examples below:

R_CS00185736_WBS-4.046.4_CN-AA2416
R_20_WBS-4.046.2_CN-AA400
R_67_WBS-4.047.3_CN-AA400
R_CUT_CS00163192_ECP_WBS-1.67A.1_CN-AA2158_ASIT_PAYLOADS_01283
R_CS00218685_WBS-4.046.4_CN-AA12638A
R_ZZ29275284_WBS-4.68G.12.1_CN-AA1-4
R_1_ZZ31368892_IA652Z4301-1_WBS-4.68G.13.1_CN-AA1
R_IC632Z9300-1_WBS-4.68G.10_CN-AA1-1
R_ZZ23847198_IC786Z0401-2_WBS-4.68G.11_CN-AA1
R_1_IC642Z1100-201,-203_WBS-3.68A.2_CN-AA1-28.3-1
R_622Z3060-X_ZZ30368294_WBS-4.68G.12.1_CN-AA1-1
R_1_ZZ32575861_654Z1295-6_WBS-3.68A.2_CN-AA1_45.2-1
R_ZZ31353531_WBS-4.68G.12.1_CN-AA1-3
R_654Z1295-2_ZZ32575874_WBS-3.68A.2_CN-AA1_45.2-1
R_622Z5060-1_ZZ30368292_WBS-4.68G.12.1_CN-AA1-1
R_IR780Z0402-4_ZZ31948808_WBS-3.68A.2_CN-AA1-37.1
R_788Z0417-1_-2_ZZ31948806_WBS-3.68A.2_CN-AA1-37.1
R_788Z0417-3_-4_ZZ31948814_WBS-3.68A.2_CN-AA1-37.1
R_627Z3200-2_ZZ31948903_WBS-3.68A.2_CN-AA1_40.1
0
Comment
Question by:mlaurin
  • 2
3 Comments
 
LVL 41

Expert Comment

by:ralmada
ID: 24759494
Something like this:
SELECT iif(instr(field1, "WBS-") <> 0, left(right(field1,  len(field1) - instr(field1, "WBS-") -3), instr(right(field1,  len(field1) - instr(field1, "WBS-") -3), "_")-1), "") as newcolumn
FROM Table1;

Open in new window

0
 
LVL 41

Accepted Solution

by:
ralmada earned 500 total points
ID: 24759509
And if you want to include WBS as well, try this:
SELECT iif(instr(field1, "WBS-") <> 0, left(right(field1,  len(field1) - instr(field1, "WBS-") +1), instr(right(field1,  len(field1) - instr(field1, "WBS-")), "_")), "") as newcolumn
FROM Table1;

Open in new window

0
 

Author Closing Comment

by:mlaurin
ID: 31599016
Wow!  Perfect, thanks!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

713 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