| Author |
Topic  |
|
|
jd343
Starting Member
7 Posts |
Posted - 11/26/2012 : 15:04:47
|
Hello There
Thank you for taking time to read this post.
I have an application I use to import a csv file from suppliers. The application processes the file then
uploads to a shopping cart products.
The application allows you to edit files using mysql make changes to it before upload. I want to change
the categories names in the file to my own ones- on the fly rather than having to import into excel first
change manually then use the edited csv file, and then add other categories names to that replaced value.
Bascially I want to know correct way of using REPLACE and CONCAT together.
For example a column 6 in supplier files represent the suppliers Categories.
REPLACE([CSV_COL(6)],'Notebook','Laptop')
this correctly changes all category Names in supplier file from Notebook to Laptop
secondly
CONCAT("Default Category|Computers|",[CSV_COL(6)])
This adds Default Category|Computers in front of whatever the value is in column 6 which carrying on from the
example above would be Notebook
So final category location would be
Default Category|Computers|Notebook
BUT I am trying to get it to add the REPLACED value at the end so it looks like this.
Default Category|Computers|Laptop
Please can anyone explain how I would achieve this
join these 2 together or any other way to achieve what i want to do.
REPLACE([CSV_COL(6)],'Notebook','Laptop')
CONCAT("Default Category|Computers|",[CSV_COL(6)])
Regards |
|
|
bitsmed
Posting Yak Master
Denmark
107 Posts |
Posted - 11/26/2012 : 16:18:08
|
This forum is for MS SQL Server, but as your question is generic sql, you might want to try this:
concat('Default Category|Computers|',replace([csv_col(6)],'Notebook','Laptop')) |
 |
|
|
jd343
Starting Member
7 Posts |
Posted - 11/26/2012 : 17:06:19
|
thank you for your help.
It brings error saying it Cannot evaluate expression check syntax
any ideas please?
Thank you once again for the help. much appreciated |
 |
|
|
jd343
Starting Member
7 Posts |
Posted - 11/26/2012 : 17:31:34
|
please ignore above comment bitsmed thank you Very Much your solution works correct. Really Appreciate your help very kind of of you. Spent along time trying to make it work and you have made me very happy.
I want to try to achieve 2 things more with this but I want to try first if I can not get it correct I will post on here.
Will keep updated.
Much appreciated
|
 |
|
|
jd343
Starting Member
7 Posts |
Posted - 11/27/2012 : 14:56:08
|
I am trying to add more categories to the expression above
concat('Default Category|Computers|',replace([csv_col(6)],'Notebook','Laptop'))
for example Printer to Laser
I have alot of categories to replace but I find I get error with syntax if I just add comma and and next values to replace.
concat('Default Category|Computers|',replace([csv_col(6)],'Notebook','Laptop')) what is the correct and easy way to make a list of values to replace please.
Kind Regards
|
 |
|
| |
Topic  |
|