Replace in update, change the extension to file names

3

I have a table with images, images , in which one of these columns ( file_name ) has image names, jpg other png , what I need is to change, make UPDATE all to the extension png , that is, change any extension that has and put png .

PS: There are file names that have points in addition to the extension, eg: "41sUhh.mGDDL. SY355 .jpg"

    
asked by anonymous 21.10.2016 / 13:45

1 answer

2

Use replace ()

update tabela set file_name = replace(file_name, '.jpg', '.png');

You only have to be careful to not have more than one occurrence of .jpg in your caminho_foto column.

    
21.10.2016 / 13:52