简体   繁体   中英

mysql replace parts of a string

I'm trying to do this in mysql . How can I replace parts of a string in a column in MYSQL with 1000 records. Change all records form .JPG to .gif

eg. DC3444.JPG to DC3444.gif

update your_table 
set some_column = replace(some_column, '.JPG', '.gif')
UPDATE table1 SET col1 = REPLACE(col1, '.JPG','.gif')

使用它作为参考: http : //dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_replace

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM