Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace a single character

Status
Not open for further replies.

stocktondesigns

Technical User
Aug 31, 2003
16
US
I have a 20,000 + record table, I am viewing the table in Access with has a 20,000 row limit on what I can see. The table contains activation codes, some of the codes have an incorrect character at the beginning, an H should be a B, is there a way that I can run an update that will go through the table replacing the H's with B's? I'm not sure if a search/replace will do it because there are bound to be H's elsewhere in each activation code. Would appreciate tips on how to do this.

Example code:
H2807-Y7F5R-MKTPO-HPRLO
needs to be
B2807-Y7F5R-MKTPO-HPRLO
 
I think should work.

UPDATE table
SET field = 'B' + Right(field, Len(field) -1)
WHERE Left(field, 1) = 'H'

--John [rainbow]
-----------------------------------
Behold! As a wild ass in the desert
go forth I to do my work.
--Gurnie Hallock (Dune)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top