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.
Parameter code is mandatory, code evaluates to an integer value from 0 to 255.
SELECT CHAR(65) AS Result;
SELECT CHAR(165) AS Result;
SELECT CHAR(67, 255) AS Result;
The char function requires 1 argument(s). As shown in the above example, when multiple integers are provided, it gets an error.
SELECT CHAR(1000) AS Result;
The above example results in NULL because the input is out of the range from 0 to 255.
SELECT 'Hello' + CHAR(10) + 'World' AS Result;
In the above example, the CHAR(10) returns the new line, therefore, the second string is placed in the new line.
- Difference between Structured Query Language (SQL) and Transact-SQL (T-SQL)
- CHAR vs VARCHAR in SQL
- Difference between char and nchar : MS SQL Server Datatypes
- SQL | Procedures in PL/SQL
- SQL | Difference between functions and stored procedures in PL/SQL
- Difference between SQL and T-SQL
- SQL | Conversion Function
- SQL Server | STUFF() Function
- How SYSDATE function works in PL/SQL
- SQL | ENCRYPT Function
- RAWTOHEX Function in PL/SQL
- SQL Server LAG() function Overview
- SIN() and COS() Function in SQL Server
- RANK() Function in SQL Server
- SQL Server LEAD() function Overview
- NTILE() Function in SQL Server
- STR() Function in SQL Server
- UNICODE() Function in SQL Server
- SUBSTRING() Function in SQL Server
- RTRIM() Function in SQL Server
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.