Forum Moderators: coopster

Message Too Old, No Replies

HOW TO change all commas to a space in MySQL?

         

Ataraxia

2:45 pm on Oct 6, 2004 (gmt 0)

10+ Year Member



OK, here's another MySQL syntax question:

The following works fine for replacing "normal" words in a MySQL table:


UPDATE tablename SET fieldname=(REPLACE (fieldname, 'oldword','newword'));

However, I have a situation where I need to change every comma that appears as text in a particular field to a space.

How would I do that?
Thanks!

Ataraxia

2:51 pm on Oct 6, 2004 (gmt 0)

10+ Year Member



Would it be as simple as this?

UPDATE tablename SET fieldname=(REPLACE (fieldname, ',',' '));

(There is a space between the last set of single quotes)

Sorry for being so nit-picky. It's just that I cannot take any chances on messing my database up if this is incorrect.

Thanks

coopster

2:57 pm on Oct 6, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Yes.

>>I cannot take any chances on messing my database up...

You can always create a sample table and test it there ;)
Or use the "test" database in MySQL.