I'm switching from a windows server to a linux server and case sensitivity is a bit of a problem in the database. For most fields I've just been able to use the following command:
UPDATE images_T SET image_path = LOWER(image_path)
However for one of the fields I need to change just the JPG part to jpg and keep all other capitalization. Eg. \images\T\12435.JPG I want to change to \images\T\12435.jpg so I want to k开发者_如何学编程eep the capital T. I've tried using the RIGHT function to do this but haven't had much luck.
UPDATE images_T SET image_path = REPLACE(image_path, '.JPG', '.jpg')
With LEFT+Right
(works with any extension):
UPDATE images_T SET image_path = CONCAT(
LEFT(image_path, length(image_path - 3))
, lower(RIGHT(image_path, 3))
)
You can try this
UPDATE images_T set image_path = replace(image_path,'.JPG','.jpg');
Try REPLACE
精彩评论