SQL Server/T-SQL/String Functions/CHAR

Материал из SQL эксперт
Перейти к: навигация, поиск

CHAR(65): 65 is A

1>
2> SELECT CHAR(65)
3> GO
-
A
(1 rows affected)
1>



CHAR(CAST(0x3A as int))

1> SELECT  CHAR(CAST(0x43 as int)) + CHAR(CAST(0x3A as int)) +
2> CHAR(CAST(0x5C as int)) + CHAR(CAST(0x50 as int)) + CHAR(CAST(0x72 as int))
3>    + CHAR(CAST(0x6F as int)) + CHAR(CAST(0x67 as int))
4>    + CHAR(CAST(0x72 as int)) + CHAR(CAST(0x61 as int))
5>    + CHAR(CAST(0x6D as int)) + CHAR(CAST(0x20 as int))
6>
7> GO
-----------
C:\Program
(1 rows affected)
1>



CHAR: the reverse of the ASCII function as it changes a numeric value in to an ASCII character

1> --CHAR: the reverse of the ASCII function as it changes a numeric value in to an ASCII character.
2>
3> DECLARE @ASCII_VALUE INT
4> SET @ASCII_VALUE = 82
5> SELECT CHAR(@ASCII_VALUE)
6>
7> GO
-
R
(1 rows affected)
1>