Results 1 to 10 of 14

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,162
    Plugin Contributions
    0

    Default SQL command to find and replace a word in the products description?

    Need help with a SQL command to find and replace one word in the products_description table, and set products_description to a new word, where products_description is this word..

    I have the word hematite around 400 times in the product_description and want to change to magnatite

    UPDATE products_description
    SET products_description = 'magnatite'
    WHERE products_description = 'hematite';

    1. admin panel/ tools/ install sql patches
    2. I insert the following and get 1 processed but no change
    3. What is wrong...
    Mark
    Hare Do

  2. #2
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: SQL command to find and replace a word in the products description

    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  3. #3
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,162
    Plugin Contributions
    0

    Default Re: SQL command to find and replace a word in the products description

    Quote Originally Posted by yellow1912 View Post
    Yellow1912,
    SELECT REPLACE('hematite', 'hematite', 'magnatite');

    1. I click send
    2. 1 statement processed
    3. But no change on the page.
    4. What is wrong???
    Mark
    Hare Do

  4. #4
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: SQL command to find and replace a word in the products description

    Select is ....select, that's it, it doesnt do anything to the records

    You have to use update instead of select if you want to make changes to your db. Always back up first.
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  5. #5
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,162
    Plugin Contributions
    0

    Default Re: SQL command to find and replace a word in the products description

    Quote Originally Posted by yellow1912 View Post
    Select is ....select, that's it, it doesnt do anything to the records

    You have to use update instead of select if you want to make changes to your db. Always back up first.
    Yellow1912,
    Thank you,

    UPDATE products_description SET products_description = REPLACE('hematite', 'hematite', 'magnatite');

    1. Yes i am on a demo site.
    2. thanks for the reminder of database backup
    3. when I put the code in above it eliminate all my wording and places magnatie
    4. Instead of:
    5. Magnatite is a gods natural stone. etc. etc
    Mark
    Hare Do

  6. #6
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: SQL command to find and replace a word in the products description

    well, because you are doing it incorrectly. Always, always read the document carefully, it is straight forward.

    An example they use

    mysql> SELECT REPLACE('www.mysql.com', 'w', 'Ww');
    -> 'WwWwWw.mysql.com'
    So in your case you may want to try

    UPDATE products_description SET products_description = REPLACE(products_description, 'magnatite', 'hematite');

    Something like that. Assuming you want to change from magnatite to hematite
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

 

 

Similar Threads

  1. v139h SQL find and replace
    By gloerick in forum General Questions
    Replies: 4
    Last Post: 12 Dec 2022, 09:16 PM
  2. Replies: 3
    Last Post: 11 May 2012, 12:35 PM
  3. Word HEADER_ bin the menu bar and after the word login
    By moro in forum Installing on a Windows Server
    Replies: 1
    Last Post: 18 Dec 2011, 03:14 PM
  4. Adding an attribute to all products using SQL command?
    By arniesbarmyarmy in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 20 Oct 2009, 03:47 AM
  5. SQL Patch command / query for changing description.
    By signprint in forum General Questions
    Replies: 3
    Last Post: 15 Mar 2009, 12:34 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR