Categories: String

SPLIT_PART

Splits a given string at a specified character and returns the requested part.

Syntax

SPLIT_PART(expression varchar, delimiter varchar, part_number int32) → varchar

  • expression: Input expression.
  • delimiter: String representing the delimiter to split the input expression by.
  • part_number: Requested part of the split. If the value is negative, the parts are counted backwards from the end of the string.

Examples

SELECT SPLIT_PART('127.0.0.1', '.', 1)
-- 127