ASCII (Transact-sql)
Soldaki karakteri bir karakter ifade ASCII kodu değerini döndürür.
Transact-SQL Sözdizim Kuralları
Sözdizimi
ASCII ( character_expression )
Bağımsız değişkenler
- character_expression
Olan bir ifade türü charya varchar.
Dönüş Türleri
int
Örnekler
Aşağıdaki örnek, ASCII karakter kümesi varsayar ve döner ASCIIdeğeri ve CHARdizedeki her karakter için karakter Du monde entier.
SET TEXTSIZE 0
SET NOCOUNT ON
-- Create the variables for the current character string position
-- and for the character string.
DECLARE @position int, @string char(15)
-- Initialize the variables.
SET @position = 1
SET @string = 'Du monde entier'
WHILE @position <= DATALENGTH(@string)
BEGIN
SELECT ASCII(SUBSTRING(@string, @position, 1)),
CHAR(ASCII(SUBSTRING(@string, @position, 1)))
SET @position = @position + 1
END
SET NOCOUNT OFF
GO
SET TEXTSIZE 0
SET NOCOUNT ON
-- Create the variables for the current character string position
-- and for the character string.
DECLARE @position int, @string char(15)
-- Initialize the variables.
SET @position = 1
SET @string = 'Du monde entier'
WHILE @position <= DATALENGTH(@string)
BEGIN
SELECT ASCII(SUBSTRING(@string, @position, 1)),
CHAR(ASCII(SUBSTRING(@string, @position, 1)))
SET @position = @position + 1
END
SET NOCOUNT OFF
GO
Sonuç kümesi buradadır.
----------- -
68 D
----------- -
117 u
----------- -
32
----------- -
109 m
----------- -
111 o
----------- -
110 n
----------- -
100 d
----------- -
101 e
----------- -
32
----------- -
101 e
----------- -
110 n
----------- -
116 t
----------- -
105 i
----------- -
101 e
----------- -
114 r
----------- -
68 D
----------- -
117 u
----------- -
32
----------- -
109 m
----------- -
111 o
----------- -
110 n
----------- -
100 d
----------- -
101 e
----------- -
32
----------- -
101 e
----------- -
110 n
----------- -
116 t
----------- -
105 i
----------- -
101 e
----------- -
114 r