OT: MySQL mass updates

Tom Watts wattst-dxuVLtCph9gsA/PxXw9srA at public.gmane.org
Mon Jun 5 20:28:58 UTC 2006



William O'Higgins Witteman wrote:
> I have a database that needs updating, and I just wanted to see if
> anyone has done something like this before.
> 
> Here's the problem - I have a constant string in one column that needs
> to be updated to a different string, for all record.
> 
> In pseudocode, what I want to do is this:
>   foreach row in table
>     in column A, swap "something" with "somethingelse" leaving the rest
>     of the column's content alone
> 
> I think that this could be done with a single, fairly simple command,
> but I'd hate to screw up the whole database by getting it wrong.
> 
> Anyone have any suggestions?  Thanks.


Sounds like a fairly simple query.  If you're so concerned about messing 
up, could you just duplicate the database for testing purposes then run 
an update on the official database once you're satisfied?

Tom Watts
wattst-dxuVLtCph9gsA/PxXw9srA at public.gmane.org
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list