CHAR function in SQL Server
The article will explore and show you how to use the CHAR function in SQL Server to convert ASCII code values into characters.
Describe
CHAR function in SQL Server is used to convert an integer expression into the corresponding character in ASCII code.
The CHAR function is used against the ASCII Quantrimang function introduced in the previous article.
Syntax
To run CHAR function in SQL Server, we use the following syntax:
CHAR(bieu
compare it)
Parameters :
- How to compare : an integer value from 0 to 255 . If the integer expression is a value outside of this range , CHAR () will return NULL .
CHAR function can only be used in later versions of SQL Server: SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005.
For example
Take a look and explore some examples of CHAR functions in SQL Server.
SELECT CHAR('113');
Result: q
SELECT ASCII('81');
Result: Q
See also: ASCII encoding and Latin character table ISO 1252
Last lesson: ASCII function in SQL Server
Next lesson: CHARINDEX function in SQL Server
You should read it
May be interested
- FUNCTION (Function) in SQL Serverthe function in sql server is stored in the database so you can pass the parameters as well as return the values. the article will give you the syntax and examples of how to create and delete functions in sql server.
- SUM function in SQL Serverthe sql server sum function returns the total value of a column, a data set, or an expression.
- The wctomb () function in Cthe function int wctomb (char * str, wchar) converts the wide char into its multi-byte representation and stores it at the beginning of the character array pointed to by str.
- The strrchr () function in Cchar * strrchr (const char * str, int c) looks for the last occurrence of the character c (an unsigned char) in the string pointed to by parameter str.
- Strcpy () function in Cchar * strcpy function (char * dest, const char * src) copies the string pointed to by src to dest.
- The sprintf () function in Cthe int sprintf function (char * str, const char * format, ...) in the standard c library sends the formatted output to a string str.
- AVG function in SQL Serverthe avg function in sql server returns the average value of an expression or average value according to the specified column of the selected row.
- ABS function in SQL Serverthis article will show you in detail how to use the abs () handling function in sql server with specific syntax and examples to better visualize and capture functions.
- DATEPART function in SQL Serverthe datepart function in sql server returns a time value of the input argument, which can be day, month, year, quarter, hour, minute, second, millisecond ... the return value is an integer type (int)
- The function sscanf () in Cthe function int sscanf (const char * str, const char * format, ...) in library c standard reads the input formatted from a string.