SQL Server ASCII() Function
THE WORLD'S LARGEST WEB DEVELOPER SITE

SQL Server ASCII() Function

❮ SQL Server 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: SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005

❮ SQL Server Functions