Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

InstrRev

Example

Find the position of the letter “t” in the string “Customer”, searching from the end of the string towards the beginning.

SELECT InstrRev(“Customer”“t”AS MatchPosition;

Definition and Usage

The InstrRev() function retrieves the position of the last occurrence of a substring within another string, performing a case-insensitive search from the end of the string.

Syntax

InstrRev(string1string2startcompare)

Parameter Values

Parameter

Description

string1

Required. Specifies the string within which to search.

string2

Required. Specifies the substring to search for within another string.

start

Optional. Specifies the starting position for the search. The default is -1, indicating that the search starts from the last character position of the string.

compare

Optional. Specifies the type of string comparison to use.

Possible values:

-1: Use the setting from Option Compare
0: Perform a binary comparison
1: Perform a textual comparison
2: Perform a comparison based on database-specific information

Return Values

  • If string2 is not found within string1, the function returns 0.
  • If string2 has a length of zero, the function returns the value specified in the start parameter.
  • If string1 has a length of zero, the function returns 0.
  • If string1 is null, the function returns null.
  • If the start parameter is greater than the length of string2, the function returns 0.Technical Details

Technical Details

Works in:

 From Access 2000