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?
UPDATE tbl SET col=REPLACE(col, 'US-Complete', 'US Complete');
If there are spaces in front and back, perhaps you should add some extra
insurance to avoid changing 'US-Completely' or 'BUS-Complete' as well:
UPDATE tbl SET col=REPLACE(col, ' US-Complete ', ' US Complete ');
The best insurance is to do a SELECT first to see what will be changed:
SELECT col, REPLACE(col, 'US-Complete', 'US Complete') FROM tbl;
Baron
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]