Str() and StrComp() Function in MS Access

1. Str() Function :
In MS Access, the Str() function return a number in the string format. In this function, we can pass any number the function will return that in the string format.

Syntax :

 Str(number) 

Example –

SELECT Str(100) AS ConvertToString;

Output –

ConvertToString
100

Example –



SELECT Str(421) AS ConvertToString;

Output –

ConvertToString
421

2. StrComp() Function :
In MS Access, The StrComp() function compare two strings . It will take two parameter string1, string2 as the parameter. If both strings will be same then it will return 0, and if the first string is greater than second then it will return 1 if string1<string2 then it returns -1 and if string1 or string2 is null then it will return null.

Syntax :

StrComp(string1, string2) 

Example –

SELECT StrComp("geeksforgeeks", "gfg") AS CompString;

Output –

CompString
-1

Example –

SELECT StrComp("gfg", "geeksforgeeks") AS CompString;

Output :

CompString
1
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.