Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2008
    Posts
    13
    Plugin Contributions
    0

    Default How do I change multiple product names all at once using an SQL Query?

    Hi All!

    I realized I misspelled "cord" wrong on a few items in my store and want to change them all to the correct spelling at once using an SQL Query but have no idea how to write one. I have about 30 products that were added to the store and spelled "Chord" instead of "Cord". Anyone want to take a stab at it? Thanks

  2. #2
    Join Date
    Mar 2008
    Location
    Brussels, Belgium
    Posts
    69
    Plugin Contributions
    0

    Default Re: How do I change multiple product names all at once using an SQL Query?

    Backup the DB and then run the following SQL statement :


    update `products_description` set `products_name` = 'Cord' where `products_name` = 'Chord'

    Note that the name of the table 'products description' might be prefixed in your setup.

  3. #3

    Default Re: How do I change multiple product names all at once using an SQL Query?

    Quote Originally Posted by tryphon View Post
    update `products_description` set `products_name` = 'Cord' where `products_name` = 'Chord'
    This will only change products which are named 'Cord' EXACTLY. It won't change products like 'Cord A', 'Nice Cord' etc. It might not also change products like 'cord' if Your collation in database is set to case sensitive.

    I think this is what You want (but backup Your database before executing those statements!):
    Code:
    UPDATE products_description
    SET products_name = REPLACE(products_name,'Cord','Chord')
    WHERE products_name like '%cord%'
    but REPLACE is case sensitive, so You might want to execute also
    Code:
    UPDATE products_description
    SET products_name = REPLACE(products_name,'cord','chord')
    WHERE products_name like '%cord%'

 

 

Similar Threads

  1. v151 SQL query setup. How do I TEST a query 'off-line'?
    By lewisasding in forum General Questions
    Replies: 3
    Last Post: 8 Mar 2013, 12:24 AM
  2. Replies: 1
    Last Post: 25 May 2012, 04:23 AM
  3. Bulk change to order status using SQL query for certain products?
    By neo2810 in forum Managing Customers and Orders
    Replies: 3
    Last Post: 24 Feb 2012, 08:34 PM
  4. Change Product Quantity in All Products at once
    By LadyMorgana in forum Customization from the Admin
    Replies: 6
    Last Post: 12 Nov 2010, 07:05 PM
  5. How to Change Date Expected in All Products At Once?
    By dzkidz in forum Customization from the Admin
    Replies: 0
    Last Post: 30 Jul 2010, 08:05 PM

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