Solved

Update SQL to remove all characters after Certain text

Posted on 2015-02-23
2
134 Views
Last Modified: 2015-02-23
I have one field that has 6 types of test in one field.

1. HMM
2. HTC
3. TMMC North
4. TMMC South
5. TMMC TIER
6. TMMC WEST.

For all records that have TMMC * I would like the text to simply read "TMMC".

So how can I use an Update Query (SQL Statement) to convert all TMMC North,TMMC South, TMMC West, TMMC TIER to simply read "TMMC'.
0
Comment
Question by:ggodwin
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 40626699
If you are certain that you want to convert all records containing any variation of "TMMC" to show ONLY "TMMC":

UPDATE YourTable SET YourField='TMMC' WHERE YourField LIKE 'TMMC*'

I would strongly recommend you create a backup before running code like this, of course.
0
 

Author Closing Comment

by:ggodwin
ID: 40626749
Worked like a charm. Thank you!
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
unable to save new report from old one 9 31
Access 2016 7 35
VBA Access 2016 syntax 6 44
VBA to copy the database back end to a new database file. 3 35
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

809 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