Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i do a update query using concatenate in SQL Server?

I tried to run this query in SQL server:

update ABC set data = concat(data, 'a');

this returns: concat is not a built in function

like image 494
Mohan Avatar asked Mar 26 '15 20:03

Mohan


People also ask

Can we use concat in update query?

Here each user posts are different so we can't apply any update command so we will use concat to add the site signature to each post kept inside a record field in our update command. Now let us see how it is used in a MySQL table query.

How do you concatenate the results of SQL query?

To append a string to another and return one result, use the || operator. This adds two strings from the left and right together and returns one result. If you use the name of the column, don't enclose it in quotes. However, in using a string value as a space or text, enclose it in quotes.


1 Answers

Make sure your database is in compatibility level 110, otherwise you can use the old style concat:

UPDATE ABC
SET data = data + 'a'
like image 136
Pam Lahoud Avatar answered Oct 08 '22 20:10

Pam Lahoud