bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MS Access StrComp() Function

Concept visual

MS Access StrComp() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Compare two strings:

Select

StrComp("SQL Tutorial", "SQL Tutorial") AS CompString;

Definition and Usage

The StrComp() function compares two strings. The result is returned as an integer based on the comparison:

Formula

If string1 = string2, this function returns 0
If string1 < string2, this function returns - 1
If string1 > string2, this function returns 1
If string1 or string2 is null, this function returns null

Syntax

StrComp(

string1, string2, compare )

Parameter Values

Parameter

Description string1 and string2

Required. The two strings to compare compare Optional. The type of comparison to perform.

Possible values:

-1: Uses option compare 0: Binary comparison 1: Textual comparison 2: Comparison based on your database

Technical Details

Works in:

From Access 2000

More Examples

Example

Compare two strings:

SELECT StrComp("SQL Tutorial", "SQL") AS CompString;

Example

Compare two strings:

SELECT StrComp("SQL", "SQL Tutorial") AS CompString;

Previous

❮ MS Access Functions

Next

Previous

MS Access Str() Function

Next

MS Access StrConv() Function