Forums / General Questions / Could not find a DB thread about how to change image names in the mysql database

Could not find a DB thread about how to change image names in the mysql database

Locked

Views: 903

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
10 Mar 2009, 5:11 PM
#1
blakdeth77 avatar

blakdeth77

New Zenner

Join Date:
Oct 2008
Location:
Burnsville MN
Posts:
40
Plugin Contributions:
0

Could not find a DB thread about how to change image names in the mysql database

I'd like to know if someone could show me how to use the SQL Query Executor to change references to the image files... like for instance say I'd like to go change a product picture for ALL products that use this image "/images/AEM.jpg" to "/images/aem.jpg" ?

I think it's a fairly simple query to run, but I'm unsure how to limit the query's changes to the correct fields in my database. I don't just want the query to run willy nilly about the database trashing every entry of AEM.jpg . lol..

:lamo:

Thanks in advance!!

Broadview Technology Solutions - Burnsville, MN
http://www.broadviewtech.com/

10 Mar 2009, 6:48 PM
#2
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Could not find a DB thread about how to change image names in the mysql database

First of all, the images/ folder is the default, so the database stores locations of all images in that folder simply as filename.ext

You could run this query from the Install SQL Patches tool:

UPDATE products SET products_image = 'aem.jpg' WHERE products_image = 'AEM.jpg';

Note that default database installations most commonly use a collation of latin or latin_swedish_ci, which means comparisons of non-binary strings (which the products_image field is) will be case-insensitive. So the query suggested above is actually going to change all instances of aem.jpg regardless of case: eg aem.jpg, aEm.JPG, AEM.jpg etc.

Neville
An assumption is what you arrive at when you get tired of thinking...