SPLIT_PART
All functions > STRING > SPLIT_PART
Returns a specific part of a string after splitting by a delimiter.
Syntax
SPLIT_PART(expr, delimiter, index)
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
string | VARCHAR | Yes | String to split |
delimiter | VARCHAR | Yes | Delimiter to split on |
index | BIGINT | Yes | 1-indexed position of the part to return |
Returns
The specified part after splitting, or empty string if index out of range
Notes
- Index is 1-based (first part is 1, not 0)
- Returns empty string if index is out of bounds
- More efficient than SPLIT when only one part is needed