How To Find the ASCII Value of each character in your String – SQL Server


 
Here’s a simple query that lists the ASCII Value of each character in your string in SQL Server

DECLARE @counter int = 1;DECLARE @colString varchar(10) = 'AA%#& ';
WHILE @counter <= DATALENGTH(@colString)
BEGIN
SELECT CHAR
(ASCII(SUBSTRING(@colString, @counter, 1))) as [Character],
ASCII(SUBSTRING(@colString, @counter, 1)) as [ASCIIValue]

SET @counter = @counter + 1
END
GO
 

Comments

Popular posts from this blog

How to Convert Word Document to PDF using C#

Loop Through Dates in SQL