On 28/06/05, Brian Dunning <[EMAIL PROTECTED]> wrote:
> Hi all -
> 
> I have an urgent need to update several million records. There is a
> URL stored in a MySQL 'text' field. Many of the records contain
> "1234" like this:
> 
> http://www.domain.com?etc=etc&arg=1234&etc=etc
> 
> Any occurence of "1234" has to be changed to "5678" like this:
> 
> http://www.domain.com?etc=etc&arg=5678&etc=etc
> 
> ...without changing the rest of the string. I'm hoping it's possible
> to make this update to the entire table with a single SQL
> statement???? If so I have no idea how to create it. Any help
> appreciated.   :)

I think the replace() function should do it:

update [table_name] set [field_name] =
replace([field_name],'[string_to_find]','[string_to_replace]');

I use it quite a lot - lifesaving-function :)  Hope this helps,

-- 
Will   
-- The Corridor of Uncertainty --
-- http://www.cricket.mailliw.com/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to