Open In App
Related Articles

CHAR() Function in SQL

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
CHAR() : This function could be used to find the character based on the ASCII (American Standard Code for Information Interchange) code. CHAR() function do not support multiple integers as arguments. Syntax :
SELECT CHAR(code);
Note – Parameter code is mandatory, code evaluates to an integer value from 0 to 255. Example-1:
SELECT CHAR(65) AS Result;
Output :
Result
A
Example-2:
SELECT CHAR(165) AS Result;
Output :
Result
¥
Example-3:
SELECT CHAR(67, 255) AS Result;
Output : The char function requires 1 argument(s). As shown in the above example, when multiple integers are provided, it gets an error. Example-4:
SELECT CHAR(1000) AS Result;
Output :
Result
NULL
Note – The above example results in NULL because the input is out of the range from 0 to 255. Example-5:
SELECT 'Hello' + CHAR(10) + 'World' AS Result;
Output :
Result
Hello
World
Note – In the above example, the CHAR(10) returns the new line, therefore, the second string is placed in the new line.

Last Updated : 31 Aug, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads