Open In App

Chr() and Asc() Function in MS Access

Last Updated : 21 Aug, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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


Similar Reads

PLSQL | CHR Function
The string in PL/SQL is actually a sequence of characters with an optional size specification. The characters could be numeric, letters, blank, special characters or a combination of all. The CHR Function in PLSQL is the opposite of the ASCII function and is used to return the character based on the NUMBER code. Syntax: CHR( number_code ) Parameter
1 min read
Hex() and Oct() Function Function in MS Access
1. Hex() Function : Hex() Function in MS Access is used to returns a String representing the hexadecimal value of a number. Syntax : Hex(number) Parameter : This method accepts one parameter as mentioned above and described below : number : It is any valid numeric expression or string expression. Returns : If the number is null it returns null, if
2 min read
SLN() and SYD() Function Function in MS Access
1. SLN() Function : SLN() Function in MS Access is used to calculate the straight-line depreciation of an asset for a single period. Syntax : SLN(cost, salvage, life) Parameter : This method accepts three parameters as mentioned above and described below : cost : It specify the initial cost of the asset. salvage : It specify the value of the asset
3 min read
DDB () and FV() Function Function in MS Access
1. DDB() Function : DDB() Function in MS Access is used to calculate the depreciation of an asset for a specific time period using the double-declining balance method or some other method. The DDB function uses the following formula to calculate depreciation for a given period : Depreciation / period = ((cost – salvage) * factor) / life Syntax : DD
4 min read
Val() and Sum() Function in MS Access
1. Val() Function : val() function returns the number found in the string. In this function, it takes a string as a parameter and it will return the number in the string. Note : This function will stop reading when the first non-numeric character comes. Syntax : Val(string) Example-1 : SELECT Val("234geeksforgeeks12") AS ValNum; Output - ValNum 234
1 min read
Sgn() and Sqr() function in MS Access
1. Sgn() Function : sgn() function returns sign of a number.if the number is positive then it returns 1 if number is equal to 0 then it returns 0 otherwise if number is less than 0 then it return -1. Syntax : Sgn(number) Example-1 : SELECT Sgn(93.5) AS SgnNum; Output - SgnNum 1 Example-2 : SELECT Sgn(-93.5) AS SgnNum; Output - SgnNum -1 2. Sqr() Fu
1 min read
StrConv() and StrReverse() Function in MS Access
1. StrConv() function : In MS Access ,The StrConv() function returns a converted strings.In this, we will pass first parameter string and second parameter conversion. Possible values for conversion 1For upper-case2For lower-case3For the first letter of every word to upper-case4For narrow characters to wide16For Hiragana into Katakana (Japan only)32
1 min read
InStr() and InstrRev() Function in MS Access
1. InStr() Function : The InStr() Function returns the position of a string in another string. It always returns the first occurrence of the string. It works not case sensitive. It returns 0 if the string2 is not found in string1 or string1 is null or the parameter starts in the function is greater than length of string1 and it returns null if stri
2 min read
LCase() and UCase () Function in MS Access
1. LCase() Function : In MS Access the LCase() function converts the text to lowercase from uppercase. In this function, a string is passed as a parameter and it will return the string in lowercase as a result. Syntax : LCase(text) Example - SELECT LCASE("GeekForGeeks") AS LowercaseName Output - LowercaseName geeksforgeeks Example - SELECT LCASE("G
1 min read
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
1 min read
Article Tags :