instr
function
Applies to: Databricks SQL Databricks Runtime
Returns the (1-based) index of the first occurrence of substr
in str
.
Syntax
instr(str, substr)
Arguments
str
: A STRING expression.substr
: A STRING expression.
Returns
A BIGINT.
If substr
cannot be found the function returns 0.
Examples
> SELECT instr('SparkSQL', 'SQL');
6
> SELECT instr('SparkSQL', 'R');
0
Related functions
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for