SQLite Update Syntax for string concatenation?
24,953
SQLite's string concatenation operator is "||
", not "+
"
UPDATE TestTable SET description = 'desc of ' || name;
Related videos on Youtube
Author by
Snowy
Updated on July 09, 2022Comments
-
Snowy almost 2 years
I have a table with this data
id , name , description 1 , apple , '' 2 , orange , ''
I am trying to pass the following statement to update the row so the description column is 'desc of apple' and 'desc of orange' but it is not working.
Update TestTable Set description = 'desc of ' + name
What is the proper syntax to concatenate strings?
-
yantrab almost 15 years+ is not standard SQL syntax for string concatenation.
-
Kibbee almost 15 yearsIs there a standard SQL Syntax for string concatenation? It seems every DB uses a different one. MySQL Uses Concat() function, SQL Lite using ||, SQL Server Uses +. Definitely something that should be standardized.
-
Amit Naidu over 8 yearsYes, there is a standard SQL syntax. It is
||
, adopted in the SQL-92 standard ISO/IEC 9075:1992. It's just that SQL Server and MySQL chose not to comply with the standard. Although MySQL can be coaxed by settingPIPES_AS_CONCAT