SQL Server – CHAR() – Convert ASCII code to Character with example

SQL Server – CHAR()

It will convert ASCII code to Character value, takes integer value as input parameter.

Syntax:

SELECT CHAR(integer_value)

Input parameter ->ASCII code as Integer_value ranges from 0 to 255, returns NULL value if it exceeds more then 255.

Example

Here we are passing input parameter value 65 to CHAR() function that will return Character as result.

SELECT CHAR(65) as ‘Converts ASCII code to Character’

Result

Converts ASCII code to character
——————————————-
A

If input value exceeds more then 255 then it will return NULL as result

SELECT CHAR(265) as ‘Converts ASCII code to Character’

Result

Converts ASCII code to character
——————————————-
NULL

Leave a Reply

  

  

  


3 + = 4