Solved

Altering data in column -

Posted on 2011-02-20
1
252 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
[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
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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…

688 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