View Full Version : Update Query
jmentor
02-21-2007, 11:49 PM
I have a column in a table that contains the following
strings:
Normal
Extra
Outside
I would like to use an update query that would find
the occurances of the above strings and change them to
N
E
O
Seems like it would require a form of Replace function.
Can you help please
stanl
02-22-2007, 02:50 AM
maybe something like
'pseudo-code
UPDATE table
SET column = Left(column,1)
WHERE (column='Normal' OR Column='Extra' OR column='Outside');
Stan
Joe, I posted a database that uses "Replace queries" here
http://vbaexpress.com/forum/showthread.php?t=9365&page=2
post #22 is the version and it has examples of Replace queries.
Previous attachments on that Thread have other methods that convert or replace data that you might like to look at.
jmentor
02-22-2007, 05:09 AM
Thanks for the link OBJ
There do not appear to be any attachments.
Should I be doing something else ?
Regards
Joe
Norie
02-22-2007, 06:09 AM
Joe
Do you really need to do this replace?
What if in the future the data/criteria changes?
My approach would be to set up a table with the new/old values and then use a query.
jmentor
02-22-2007, 06:52 AM
Stanl
Your example didn't work.
Anyway, perhaps my explanation wasn't very clear.
I do need to replace those words with another set of words, so if the string is Normal then this should become Blue, if it is Extra then
change to Orange and if the string is Outside then it will be Red
Norrie
No, the data will neveer change since it will be imported and then discarded.
Joe, they are definitley on that other Thread and it won't let me put them on again.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.