Retrieve the ASCII value of the initial character in the string “CustomerName”.
SELECT ASCII(CustomerName) AS NumCodeOfFirstChar FROM Customers; |
The ASCII() function provides the ASCII value associated with a particular character.
ASCII(character) |
Parameter |
Description |
character |
This parameter specifies the character for which the ASCII value is returned. If multiple characters are provided, only the ASCII value for the first character will be returned. |
Works in: |
SQL Server (beginning from 2008), Azure SQL Database, Azure SQL Data Warehouse, and Parallel Data Warehouse |