PDA

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

OBP
02-22-2007, 04:44 AM
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.

OBP
02-22-2007, 12:25 PM
Joe, they are definitley on that other Thread and it won't let me put them on again.