Thread: replace query
View Single Post

   
  #1 (permalink)  
Old 02-28-2008, 10:07 AM
Bosconian
 
Posts: n/a
Default replace query

I been playing with this for awhile, but can't seem to successfully execute
a simple replace query with MySQL 4.1.12 via phpMyAdmin 2.7.0-pl2

The table only contains around 650 records, yet the query just hangs.

I came across this syntax example:

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

My real world usage is:

UPDATE attachments SET fileloc = REPLACE(fileloc,'2001','2001\');

where the backslash is added after the 4-digit year.

An example piece of fileloc data looks like "2001DOM-MK008-C.PDF". The
column is defined as varchar(50).

Any suggestions would be greatly appreciated.


Reply With Quote