Overview
The CHAR function is used to get the actual character when the ASCII value is provided.
Explanation
Syntax
CHAR(value)Simple CHAR Example
SELECT CHAR(49)
SELECT CHAR(50)
SELECT CHAR(51)
SELECT CHAR(65)
SELECT CHAR(66)
SELECT CHAR(67)We get the following values:
1
2
3
A
B
CGet List of All CHAR Values and Integer Value
The following will get a list of the CHAR value and the corresponding character.
DECLARE @counter INT = 0
CREATE TABLE #CharValues ([char] nchar(1), [value] int)
WHILE (@counter <= 255 )
BEGIN
BEGIN TRY
INSERT INTO #CharValues
SELECT CHAR(@counter), @counter
SET @counter = @counter + 1
END TRY
BEGIN CATCH;
SET @counter = @counter + 1
IF @counter > 255
BEGIN
BREAK
END
END CATCH
END
SELECT [value], [char] FROM #CharValues
DROP TABLE #CharValuesHere are a few rows from the query results.

Additional Information
- SQL Server Char Function and Reference Guide – this includes a table of values
- SQL ASCII

Greg Robidoux has been working with databases for 35+ years with extensive hands on SQL Server experience from version 6.5 to 2025. He has authored over 250 technical articles and delivered several presentations online and at various conventions. Greg is also the President and founder of Edgewood Solutions, a technology services company delivering services and solutions for Microsoft SQL Server.


