Forum Moderators: coopster

Message Too Old, No Replies

Replace / with - in multiple mysql rows...

Replace / Modify / Update?

         

smxmedia

12:19 pm on May 14, 2005 (gmt 0)

10+ Year Member



Hi everyone.

I have a mysql database with about 2500 stock items in. The problem I have is that the addition dates are a little screwed up. The dates should have hyphens not forward slashes in the database. As you can imagine changing 1500+ rows manually would take a very long time.

The dates are like this.

e.g.

Wrong = 10/10/1000
Right = 10-10-1000

Is there an easy way to change all the slashes in the table to hyphens?

Thanks in advance.

jatar_k

3:28 pm on May 14, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld smxmedia,

it would be easy enough to write a script that will select the date, replace the / with - and then update based on row id.

there may be a mysql function that could do it but I don't know off the top of my head.

freeflight2

3:34 pm on May 14, 2005 (gmt 0)

10+ Year Member



[dev.mysql.com...]
UPDATE table SET row=REPLACE(row, '/', '-');

smxmedia

3:45 pm on May 14, 2005 (gmt 0)

10+ Year Member



Thanks freeflight ill have a play with it.