Solved

Update SQL to remove all characters after Certain text

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

680 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