INSTR()

Scalar. Returns the starting position (one-based) of a string within another string.

Syntax

INSTR( string, substring [, start [, occurrence ]])
Parameters

string

A string literal or the name of a String column.

substring

The string to locate, either a literal or the name of a String column. If the string is not found, the function returns 0.

start

The character position within string to start searching. If negative, the search starts at the end of string and proceeds backwards. If greater than the size of string, the function returns 0. If omitted, the search starts with the first character.

occurrence

Which occurrence of substring to locate. If omitted, the search looks for the first occurrence.

Data Types

Return

string

substring

start

occurrence

Integer

String

String

Integer

Integer

Example

The following example uses the INSTR function to get the position of the value of the Prefix column in the value of the Title column:

INSERT INTO OutStream
SELECT INSTR(Devices.Title, Devices.Prefix)
FROM Devices;