URL:
- http://www.nikmakris.com/2005/mar/29.html
- http://www.xaprb.com/blog/2006/04/14/bad-character-data-in-mysql/ – “How to find and fix invalid character data in MySQL”
update [table_name] set [field_name] = replace([field_name],'[string_to_find]’,'[string_to_replace]’);
another good one is
concat()
eg
update [tablename] set [field_name1] = concat([field_name1],[fieldname2])
useful if you have to make keywords or descriptions from other fields
also useful is trim()
eg
select trim(trailing ‘.png’ from [field_name]) will get the image name without the .png on the end too, so you can do
update [tablename] set [field_name2] = trim(trailing ‘.png’ from [table_name])
very useful if importing images somewhere and you have 3 cols of images, small, med and large, etc and all have the same name, just with an _sm etc on the end
that one would be
update [tablename] set [field_name2] = concat(trim(trailing ‘.png’ from [table_name]),’_sm.png’)
then you end up making
image_sm.png in field2 from image.png in field 1