?
Solved

Altering data in column -

Posted on 2011-02-20
1
Medium Priority
?
253 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 93

Accepted Solution

by:
Patrick Matthews earned 2000 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

762 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