Use of CONCAT_WS Function in SQL

Use of CONCAT_WS Function in SQL:

(1) “CONCAT_WS” function is used to concatenate more than two strings with specific values.

(2) Let’s take an example to Add four strings with value “space” ‘ERP Consultors’, ‘Provide’, ‘Best’, ‘Service’ as shown.

(3) Select the database in the SQL server and click on the “New Query” button as shown.

Select the database in the SQL server and click on the new query button

(4) After that new query editor opens as shown.

new query editor open in sql

(5) After doing the above steps, write a query in the editor, as shown.

CONCAT_WS query in sql editor

Source Code:

–//CONCAT_WS String with space
SelectCONCAT_WS(‘.’,’ERP Consultors’,’Provide’,’Best’,’Service’);
–//CONCAT_WS String with space

(6) Then Execute or Press F5 to run the query and see the result as shown

concat_ws query execute by f5

Use of OR Operator in SQL
Use of CHAR function in SQL
Use of CONCAT Function in SQL
CONCAT_WS (Transact-SQL)– Microsoft Docs

Leave a Reply