Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

CONCAT_WS

Example

Concatenate strings, using ‘.’ as the separator between concatenated string values.

SELECT CONCAT_WS(‘.’‘www’‘W3Schools’‘com’);

Definition and Usage

The CONCAT_WS() function concatenates two or more strings together, placing a specified separator between each string.

Note: Also consider using CONCAT() and the + operator for string concatenation.

Syntax

CONCAT_WS(separator, string1string2….string_n)

Parameter Values

 

Parameter

Description

separator

Mandatory. Specifies the separator to be used between concatenated strings.

String1, string2 string_n

Mandatory. Specifies the strings to be concatenated together.

Technical Details

Works in:

SQL Server (from 2017 onward), Azure SQL Database, and Azure SQL Data Warehouse

More Examples

Example

Concatenate strings together, using ‘-‘ as the separator between the concatenated string values.

SELECT CONCAT_WS(‘-‘‘SQL’‘ is’‘ fun!’);