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

ParameterTypeRequiredDescription
stringVARCHARYesString to split
delimiterVARCHARYesDelimiter to split on
indexBIGINTYes1-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

Examples

Last update at: 2025/10/13 10:23:46