Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Splits a string on a delimiter and returns the specified field.
Syntax
split_part(<string>, <delimiter>, <field>)
Arguments
Required
<string>: The string to split.<delimiter>: The delimiter string.<field>: The field number to return (1-based). Negative values count from the end.
Returns
Returns a text value that contains the specified field.
Considerations
- Field indexing is 1-based.
- Negative field numbers count from the last field backward.
- Returns an empty string if the field number exceeds the available fields.
Examples
Extract Field
Get the second field from a delimited string.
SELECT split_part('abc~@~def~@~ghi', '~@~', 2) AS result;
Returns 'def'.