目录

MS Access StrComp() 函数

示例

比较两个字符串:

SELECT StrComp("SQL Tutorial", "SQL Tutorial") AS CompString;
亲自试一试 »

定义和用法

StrComp() 函数比较两个字符串。

根据比较结果以整数形式返回:

  • 如果 string1 = string2,则该函数返回 0
  • 如果 string1 < string2,则该函数返回 -1
  • 如果 string1 > string2,则该函数返回 1
  • 如果 string1 或 string2 为 null,则此函数返回 null

语法

StrComp( string1, string2, compare)

参数值

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

技术细节

工作于: 从 Access 2000

更多示例

示例

比较两个字符串:

SELECT StrComp("SQL Tutorial", "SQL") AS CompString;
亲自试一试 »

示例

比较两个字符串:

SELECT StrComp("SQL", "SQL Tutorial") AS CompString;
亲自试一试 »