CHARINDEX

functionsupportedCore SQL functions

docs.snowflake.com ↗

String & binary functions

Searches for the first occurrence of the first argument in the second argument and, if successful, returns the position (1-based) of the first argument in the second argument. Aliases: POSITION Note that the CHARINDEX function does not support one of the syntax variations that POSITION supports.

Syntax

supportedpartialnot supportednot scored

CHARINDEX( <expr1>, <expr2> [ , <start_pos> ] )

Parameters

NameRequiredDescription
expr1requiredA string or binary expression representing the value to look for.
expr2requiredA string or binary expression representing the value to search.
start_posoptionalA number indicating the position from where to start the search (with 1 representing the start of expr2). Default: 1

Usage notes

Collation details

This function does not support the following collation specifications: - pi (punctuation-insensitive). - cs-ai (case-sensitive, accent-insensitive).