Solved

Update SQL to remove all characters after Certain text

Posted on 2015-02-23
2
132 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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.

920 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

13 Experts available now in Live!

Get 1:1 Help Now