bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL Server CONCAT_WS() Function

Concept visual

SQL Server CONCAT_WS() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Add strings together. Use '.' to separate the concatenated string values:

Select

CONCAT_WS('.', 'www', 'W3Schools', 'com');

Definition and Usage

The CONCAT_WS() function adds two or more strings together with a separator.

Note:

See also

Concat()

and

Formula

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!');

Previous

❮ SQL Server Functions

Next

Previous

SQL Server Concat With +

Next

SQL Server DATALENGTH() Function