Saturday, 14 February 2015

SQL SERVER – ASCII to Decimal and Decimal to ASCII

ASCII – Returns the ASCII code value of the leftmost character of a character expression.
CHAR – Fixed-length non-Unicode character data with length of bytes.
Examples:
----Decimal to ASCIISELECT CHAR(80)+CHAR(73)+CHAR(78)+CHAR(65)+CHAR(76ASSQLAuthorityAuthor
GO

----ASCII to DecimalSELECT ASCII('P'AS SQLAuthorityAuthorUNION ALLSELECT ASCII('I')UNION ALLSELECT ASCII('N')UNION ALLSELECT ASCII('A')UNION ALLSELECT ASCII('L')GO


No comments:

Post a Comment