Ócáid
Mar 31, 11 PM - Apr 2, 11 PM
An ócáid foghlama SQL, Fabric and Power BI is mó. Márta 31 – 2 Aibreán. Bain úsáid as cód FABINSIDER chun $ 400 a shábháil.
Cláraigh inniuNí thacaítear leis an mbrabhsálaí seo a thuilleadh.
Uasghrádú go Microsoft Edge chun leas a bhaint as na gnéithe is déanaí, nuashonruithe slándála, agus tacaíocht theicniúil.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
Azure Synapse Analytics
Analytics Platform System (PDW)
SQL analytics endpoint in Microsoft Fabric
Warehouse in Microsoft Fabric
Returns the ASCII code value of the leftmost character of a character expression.
Transact-SQL syntax conventions
ASCII ( character_expression )
character_expression
An expression of type char or varchar.
int
ASCII stands for American Standard Code for Information Interchange. It serves as a character encoding standard for modern computers. See the Printable characters section of ASCII for a list of ASCII characters.
ASCII is a 7-bit character set. Extended ASCII or High ASCII is an 8-bit character set that is not handled by the ASCII
function.
SELECT ASCII('A') AS A, ASCII('B') AS B,
ASCII('a') AS a, ASCII('b') AS b,
ASCII(1) AS [1], ASCII(2) AS [2];
Here's the result set.
A B a b 1 2
----------- ----------- ----------- ----------- ----------- -----------
65 66 97 98 49 50
SELECT ASCII('P') AS [ASCII], ASCII('æ') AS [Extended_ASCII];
Here's the result set.
ASCII Extended_ASCII
----------- --------------
80 195
To verify if the results above map to the correct character code point, use the output values with the CHAR
or NCHAR
function:
SELECT NCHAR(80) AS [CHARACTER], NCHAR(195) AS [CHARACTER];
Here's the result set.
CHARACTER CHARACTER
--------- ---------
P Ã
From the previous result, notice that the character for code point 195 is à and not æ. This is because the ASCII
function is capable of reading the first 7-bit stream, but not the extra bit. The correct code point for character æ
can be found using the UNICODE
function, which is capable or returning the correct character code point:
SELECT UNICODE('æ') AS [Extended_ASCII], NCHAR(230) AS [CHARACTER];
Here's the result set.
Extended_ASCII CHARACTER
-------------- ---------
230 æ
CHAR (Transact-SQL)
NCHAR (Transact-SQL)
UNICODE (Transact-SQL)
String Functions (Transact-SQL)
Ócáid
Mar 31, 11 PM - Apr 2, 11 PM
An ócáid foghlama SQL, Fabric and Power BI is mó. Márta 31 – 2 Aibreán. Bain úsáid as cód FABINSIDER chun $ 400 a shábháil.
Cláraigh inniu