STRTOK

functionsupportedCore SQL functions

docs.snowflake.com ↗

String & binary functions

Tokenizes a given string and returns the requested part.

Syntax

supportedpartialnot supportednot scored

STRTOK(<string> [,<delimiter>] [,<partNumber>])

Parameters

NameRequiredDescription
stringrequiredText to be tokenized.
delimiteroptionalText representing the set of delimiters to tokenize on. Each character in the delimiter string is a separate delimiter. For example, if the delimiter is '@.', then both '@' and '.' are treated as delimiters. This behavior differs from SPLIT_PART, which treats the entire delimiter as a single delimiter string. If the delimiter is empty, and the string is empty, then the function returns NULL. If the delimiter is empty, and the string is non-empty, then the whole string will be treated as one token. Default: A single space character
partNumberoptionalRequested token, which is 1-based so that the first token is token number 1, not token number 0. If the token number is out of range, then NULL is returned. Default: 1

Returns

The data type of the returned value is VARCHAR. If the requested part doesn’t exist or any argument is NULL, then NULL is returned.

Usage notes

See also

Referenced by