Reputation: 1086
I have a huge table of products from a specific vendor with a UPC column. I need to differentiate these products' UPCs from other vendors. The current idea is to prepend all of these UPCs with the letter a
.
UPDATE abc_items SET upc = 'a' + upc
is basically how I imagine doing something like this, but I know it will not work.
Upvotes: 16
Views: 10800
Reputation: 5252
Just use the CONCAT function.
CONCAT(str1,str2,...)
Returns the string that results from concatenating the arguments. May have one or more arguments. If all arguments are nonbinary strings, the result is a nonbinary string. If the arguments include any binary strings, the result is a binary string. A numeric argument is converted to its equivalent nonbinary string form.
UPDATE abc_items SET upc = CONCAT('k', upc)
Upvotes: 30