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

StrComp

Example

Perform a comparison between two strings.

SELECT StrComp(“SQL Tutorial”“SQL Tutorial”AS CompString;

Definition and Usage

The StrComp() function compares two strings and returns an integer based on the comparison:

  • Returns 0 if string1 is equal to string2.
  • Returns -1 if string1 is less than string2.
  • Returns 1 if string1 is greater than string2.
  • Returns null if string1 or string2 is null.

Syntax

StrComp(string1string2compare)

Parameter Values

Parameter

Description

string1, string

Required. Specifies the two strings that will be compared.

compare

Optional. Specifies the type of comparison to perform between the two strings.

Possible values: -1: Uses the setting of Option Compare 0: Performs a binary comparison 1: Performs a textual comparison

Technical Details

Works in:

 From Access 2000

More Examples

Example

Perform a comparison operation between two strings.

SELECT StrComp(“SQL Tutorial”“SQL”AS CompString;

Example

Perform a comparison operation between two strings.

SELECT StrComp(“SQL”“SQL Tutorial”AS CompString;