Returns the character equivalent of an integer.
char(integer_expr)
is any integer (tinyint, smallint, or int) column name, variable, or constant expression between 0 and 255.
select char(42)
- *
select xxx = char(65)
xxx --- A
char, a string function, converts a single-byte integer value to a character value (char is usually used as the inverse of ascii).
char returns a char datatype. If the resulting value is the first byte of a multibyte character, the character may be undefined.
If char_expr is NULL, returns NULL.
You can use concatenation and char values to add tabs or carriage returns to reformat output. char(10) converts to a return; char(9) converts to a tab. For example:
/* just a space */ select title_id + " " + title from titles where title_id = "T67061" /* a return */ select title_id + char(10) + title from titles where title_id = "T67061" /* a tab */ select title_id + char(9) + title from titles where title_id = "T67061"
----------------------------------------------------------------------- T67061 Programming with Curses ----------------------------------------------------------------------- T67061 Programming with Curses ----------------------------------------------------------------------- T67061 Programming with Curses
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute char.