Solved

Altering data in column -

Posted on 2011-02-20
1
249 Views
Last Modified: 2013-11-28
I have a column of data that I need to alter
the data format right  now is PenHg-001-42
I need to remove the penhg-001- and leave the numbers following the second -
0
Comment
Question by:Tagom
1 Comment
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 34940086
To simply remove PenHg-001-:


UPDATE SomeTable
SET SomeColumn = Mid(SomeColumn, 11)
WHERE SomeColumn Like "PenHg-001-*"

Open in new window



To get everything after the second hyphen:


UPDATE SomeTable
SET SomeColumn = Mid(SomeColumn, InStr(InStr(1, SomeColumn, "-") + 1, SomeColumn, "-") + 1)
WHERE SomeColumn Like "*-*-*"

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ServiceCenter IR Query Expressions 1 23
Filter a form 8 15
Progress bar in access form 11 25
Using Third Party DLL with Access VBA 14 17
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

831 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