Post by ClosedCart » Tue Mar 06, 2018 8:43 pm

1. What is the SQL Command to find multiple words in the description and replace them with another word?
2. What is the SQL command to find multiple words in the description and delete them?
3. What is the SQL Command to find multiple words in the title and replace them with another word?
4. What is the SQL command to find multiple words in the title and delete them?

New member

Posts

Joined
Tue Jun 02, 2015 9:11 pm

Post by wid » Tue Mar 06, 2018 9:44 pm

you have to create a procedure for each work

other (sloppy) way is to export sql data, find/replace to a notepad++ and import them again

take a visit to My Modules !


wid
New member

Posts

Joined
Fri Feb 02, 2018 9:19 pm
Location - Athens/Greece

Post by ClosedCart » Tue Mar 06, 2018 10:55 pm

wid wrote:
Tue Mar 06, 2018 9:44 pm
you have to create a procedure for each work

other (sloppy) way is to export sql data, find/replace to a notepad++ and import them again
Yeah I did it before the first way, by executing an SQL command... however I dont remember the commands so I need help with someone writing me the template for the command

New member

Posts

Joined
Tue Jun 02, 2015 9:11 pm

Post by Charlemagne » Wed Mar 07, 2018 4:20 pm

To update a description you could use the following SQL command from the command line:

Code: Select all

update oc_product_description set description = replace(description, "phrase you don't want", "phrase you want");
To remove "unwanted" from a product_description:

Code: Select all

update oc_product_description set description = replace(description, "unwanted", "");
To replace "unwanted" from a product's title:

Code: Select all

update oc_product_description set name = replace(description, "unwanted", "wanted");
To remove "unwanted" from a product's title::

Code: Select all

update oc_product_description set name = replace(description, "unwanted", "");
Backups can save you from a mistake
Immediately before you start using SQL (if you are not sure about it) you should backup your entire database. You can do it from the command line (in Linux) using

Code: Select all

mysqldump --host=<sql host address> --user=DatabaseUsername --password opencart_databasename > DatabaseBackup.sql
You can restore from this backup using the same command you use to execute mysql commands reading from your database backup:

Code: Select all

sql --host=<sql host address> --user=DatabaseUsername --password opencart_databasename < DatabaseBackup.sql
Last edited by straightlight on Sun Apr 26, 2020 1:15 am, edited 1 time in total.
Reason: Please add the code tags!

Newbie

Posts

Joined
Mon Feb 05, 2018 12:42 am
Who is online

Users browsing this forum: thiviyan and 23 guests