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
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With