probashi Posted October 27, 2010 Share Posted October 27, 2010 Hi all,I have imported product short and long descriptions from a CSV file. However within the descriptions, where there are commas (,) this has been replaced by , So for example a sentence will read: A good product, although cheap. When it should read:A good product, although cheap. As there are hundreds of product descriptions effected, it will be a pain to manually fix this.Can some body help me with a SQL command that will replace the , with a comma (,)Thank you in advance Link to comment Share on other sites More sharing options...
tomerg3 Posted October 27, 2010 Share Posted October 27, 2010 make sure yo have a backup of the table just in case. UPDATE ps_cms_lang SET content = replace(content , ',',','); Link to comment Share on other sites More sharing options...
probashi Posted October 27, 2010 Author Share Posted October 27, 2010 Thank you for your reply. I'm getting the below error:SQL query:UPDATE ps_cms_lang SET content = replace( content, ‘ & comma;MySQL said: Documentation#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Link to comment Share on other sites More sharing options...
tomerg3 Posted October 27, 2010 Share Posted October 27, 2010 I updated the code, it was replacing ' with a different quote Link to comment Share on other sites More sharing options...
probashi Posted October 27, 2010 Author Share Posted October 27, 2010 Thank youIt's still not working - although the SQL is not giving any errors - no rows was updated:0 row(s) affected. ( Query took 0.0005 sec ) Link to comment Share on other sites More sharing options...
probashi Posted October 27, 2010 Author Share Posted October 27, 2010 Okay is where the problem may be - just to verify with youShould it not be ps_product_lang instead of ps_cms_lang? Link to comment Share on other sites More sharing options...
tomerg3 Posted October 27, 2010 Share Posted October 27, 2010 When to see what is the actual string for the , in the content field, it may not be ,, the query is correct, I just checked it. Link to comment Share on other sites More sharing options...
probashi Posted October 27, 2010 Author Share Posted October 27, 2010 Sorry, i'm a little bit slow when it come to SQL - i don't really understand what you mean.Should we not aim the SQL at the ps_product_lang table as this is where the description is for the products within the description field.Sorry about this - thank again for your help Link to comment Share on other sites More sharing options...
tomerg3 Posted October 27, 2010 Share Posted October 27, 2010 Yeah, sorry, I had CMS in my mind for some reason.This should do the trick.... UPDATE ps_product_lang SET description = replace(description , ',',','), description_short = replace(description_short , ',',','); Link to comment Share on other sites More sharing options...
probashi Posted October 27, 2010 Author Share Posted October 27, 2010 Thank you very much, that did the trick :-) Link to comment Share on other sites More sharing options...
tomerg3 Posted October 27, 2010 Share Posted October 27, 2010 no problem, please add (solved) to the topic Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now