Solved

Altering data in column -

Posted on 2011-02-20
1
247 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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now