Skip to main content
Splits <string> at occurrences of <delimiter> and returns the <index>’th field, with 1 being the first index. If <index> is negative, returns the abs(<index>)’th-from-last field. If <delimiter> is empty, <string> is returned at <index> 1. If abs(<index>) is larger than the number of fields, returns an empty string. The function raises an error for <index> 0.

Syntax

Parameters

Return Type

TEXT

Examples

Example The following code example uses the delimiter # to split the string 'hello#world', and returns the first segment:

Rows: 1Execution time: 5.03ms

Example The following code example uses the delimiter | to split the string 'this|is|my|test', and returns the second to last segment:

Rows: 1Execution time: 8.40ms

Example The following code example uses an empty delimiter '' to split the string 'hello world', and returns the first segment. SPLIT_PART sees the empty delimiter and interprets the entire string as the first and only part of the string and returns ‘hello world’.

Rows: 1Execution time: 5.17ms

Example The following code example uses an empty delimiter '' to split the string 'hello world', and attempts to return the seventh segment. Because there is no seventh part, SPLIT_PART returns an empty string.

Rows: 1Execution time: 5.70ms