Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access query to extract data

Posted on 2009-07-01
3
Medium Priority
?
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

604 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