Skip to content
Related Articles

Related Articles

Improve Article
Chr() and Asc() Function in MS Access
  • Last Updated : 21 Aug, 2020

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
STUDENTNAMECOURSE
GFG_USER1OOPS
XYZDSA SELF PACED

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

Output –

STUDENTNumCodeOfFirstChar
GFG_USER1107
XYZ130

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
Recommended Articles
Page :