SQL Server CONCAT_WS() Function
Example
Add strings together. Use '.' to separate the concatenated string values:
SELECT
CONCAT_WS('.', 'www', 'W3Schools', 'com');
Try it Yourself »
Definition and Usage
The CONCAT_WS() function adds two or more strings together with a separator.
Note: See also CONCAT() and Concat with the + operator.
Syntax
CONCAT_WS(separator, string1,
string2, ...., string_n)
Parameter Values
| Parameter | Description |
|---|---|
| separator | Required. The separator to use |
| string1, string2, string_n | Required. The strings to add together |
Technical Details
| Works in: | SQL Server (starting with 2017), Azure SQL Database, Azure SQL Data Warehouse |
|---|
More Examples
Example
Add strings together. Use '-' to separate the concatenated string values:
SELECT
CONCAT_WS('-', 'SQL', ' is', ' fun!');
Try it Yourself »