> ## 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.

# SPLIT_PART

> Returns a selected substring after splitting a string on a literal delimiter.

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

Returns NULL when any argument is NULL.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
split_part(value, delimiter, part)
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | STRING | Yes | The string to split. |
| delimiter | STRING | Yes | The literal separator. |
| part | INTEGER | Yes | A positive 1-based part number or a negative position counted from the end. |

## Returns

* Type: STRING
* Possible values: The selected part, or an empty string when the part is out of range.
* NULL behavior: Returns NULL when any argument is NULL.

## Properties

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

## Usage notes

* An empty delimiter treats the whole input as one part.
* For a nonempty delimiter, a zero part number is treated as the first part only in the Snowflake branch; it raises an error in other dialects. With an empty delimiter, zero raises an error in every branch.

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT split_part('a,b,c', ',', 2) AS middle, split_part('a,b,c', ',', -1) AS last;
```

| middle | last |
| - | - |
| b | c |

### Empty fields and a missing field

In the result table, `''` denotes an empty string.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT split_part('a,,c', ',', 2) AS empty_field, split_part('a,,c', ',', 4) AS missing_field;
```

| empty\_field | missing\_field |
| - | - |
| `''` | `''` |


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