Combine two strings into a single string.
SELECT ‘W3Schools’ + ‘.com’; |
The + operator in SQL allows you to concatenate (join) two or more strings together.
Note: Also consider using the CONCAT() and CONCAT_WS() functions for string concatenation.
string1 + string2 + string_n |
Parameter |
Description |
String1, string2 string_n |
Mandatory. Specifies the strings to concatenate together. |
Works in: |
SQL Server (from 2005 onward), Azure SQL Database, Azure SQL Data Warehouse, and Parallel Data Warehouse |
Combine three strings into one:
SELECT ‘SQL’ + ‘ is’ + ‘ fun!’; |
Concatenate strings with each string separated by a space character.
SELECT ‘SQL’ + ‘ ‘ + ‘is’ + ‘ ‘ + ‘fun!’; |