SQL Server String Function: ASCII

ASCII, which stands for American Standard Code for Information Interchange, is a character encoding standard for communication devices. ASCII codes represent text in computers, telecommunications equipment, and other devices.

We can get ASCII code in SQL Server queries, by using ASCII functions.

Syntax:

ASCII(character)

This ASCII function will return the ASCII code of the first letter of the value entered in the function. For example in the Select query for the following category table:

SELECT categoryname, 
       ASCII(categoryname) 
FirstLetterCode FROM [dbo].[category]

Result:




Post a Comment

0 Comments