Chr() and Asc() Function in MS Access

1. CHR() Function :
The Chr() function returns the character for the given ASCII number code. The Chr function takes an integer as a parameter and returns the respective character. It works opposite to ASC() function.

Syntax –

Chr(ASCII number code)

Parameter – Required; An integer.
Return – A character.

Example –

SELECT Chr(75) 
AS NumberCodeToCharacter;

Output –



NumberCodeToCharacter
K



2. ASC() Function :
The ASC() function returns the ASCII value of the character. If more than one character is passed in the function then it will return the ASCII value of the first character otherwise ASCII value of the specified character.

Syntax –

ASC(Character)

Parameter – Required; A character or a string.
Return – ASCII value; An Integer value.

Example –


Table – Student

STUDENTNAME COURSE
GFG_USER1 OOPS
XYZ DSA SELF PACED

SELECT STUDENT, Asc(STUDENTNAME) 
AS NumCodeOfFirstChar
FROM STUDENT;

Output –

STUDENT NumCodeOfFirstChar
GFG_USER1 107
XYZ 130

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

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.