Brian Dunning wrote:
I have a column where I need to replace all instances of the text "US-Complete" (contained within a long sentence) with "US Complete". There are probably 50 or 100 of them. I'm really scared to do it since I can't risk screwing up that column - what's the correct syntax?

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

mysql> select * from replacetest;
+----+--------------------------------+
| id | reptest                        |
+----+--------------------------------+
|  1 | this is a test US-Complete wii |
|  2 | look US-Complete is here       |
|  3 | Fun test                       |
+----+--------------------------------+
3 rows in set (0.00 sec)

mysql> update replacetest set reptest=replace(reptest, 'US-Complete', 'US Complete') where reptest like '%US-Complete%';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> select * from replacetest;
+----+--------------------------------+
| id | reptest                        |
+----+--------------------------------+
|  1 | this is a test US Complete wii |
|  2 | look US Complete is here       |
|  3 | Fun test                       |
+----+--------------------------------+
3 rows in set (0.00 sec)


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

Reply via email to