> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CONCAT_WS

> Joins strings or string-array elements using a separator.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

Returns NULL for a NULL separator. NULL values and NULL array elements are skipped.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
concat_ws(separator [, value, ...])
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| separator | STRING | Yes | The string inserted between retained values. |
| value | STRING or ARRAY\<STRING> | No | A value or array of values; additional arguments are allowed. This argument can repeat. |

## Returns

* Type: STRING
* Possible values: The retained strings in argument/array order, joined with the separator.
* NULL behavior: Returns NULL for a NULL separator. NULL values and NULL array elements are skipped.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Usage notes

* Empty strings are retained as values, so they can produce adjacent separators.

## Examples

### NULL values are skipped

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT concat_ws('-', 'a', CAST(NULL AS STRING), 'b') AS "value";
```

| value |
| - |
| a-b |

### Empty strings are retained

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT concat_ws('-', 'a', '', 'b') AS with_empty_string, concat_ws('-', 'a', CAST(NULL AS VARCHAR), 'b') AS with_null;
```

| with\_empty\_string | with\_null |
| - | - |
| a--b | a-b |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.