Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'CONCAT' is not a recognized built-in function name. Update transaction with Inner Join [duplicate]

I set up a query to get to update on a table field(sql server) by concatenating other fields.

My query

UPDATE ORDER O
SET O.COD_MODEL_ORDER = CONCAT(M.COD_MODEL, '-', O.COD_ORDER)
INNER JOIN MODEL M ON M.ID_MODEL = O.ID_MODEL
WHERE ID_ORDER = 5;

Error:

'CONCAT' is not a recognized built-in function name.

Where am I going wrong?
My objective is to join Model and Order.
Update Order field concatenating two other fields:

- COD_MODEL(varchar) FROM MODEL
- COD_ORDER(varchar) FROM ORDER

like image 945
chewie Avatar asked May 30 '16 23:05

chewie


1 Answers

Why not simply concatenate using +

UPDATE O
SET O.COD_MODEL_ORDER = M.COD_MODEL + '-' + O.COD_ORDER
FROM ORDER O
INNER JOIN MODEL M ON M.ID_MODEL = O.ID_MODEL
WHERE ID_ORDER = 5;
like image 108
mhn Avatar answered Oct 11 '22 03:10

mhn