THE WORLD'S LARGEST WEB DEVELOPER SITE

MySQL ASCII() Function

❮ MySQL Functions

Example

Return the number code of the first character in "CustomerName":

SELECT ASCII(CustomerName) AS NumCodeOfFirstChar
FROM Customers;
Try it Yourself »

Definition and Usage

The ASCII() function returns the number code that represents the specific character.

Syntax

ASCII(character)

Parameter Values

Parameter Description
character Required. The character to return the number code for. If more than one character is entered, it will return the value for the first character and ignore all the rest.

Technical Details

Works in: MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

❮ MySQL Functions