|
char()
The
string function
char()
returns the character that corresponds to the number given in the parameter "integer_expression" in the range between 0 and 255. The string function char() works opposite to the ascii() function.
Syntax of the string function char()
char([integer_expression])
The parameter of the string function char()
integer_expression
The parameter "integer_expression" can be a number of one of these
datatypes:
tinyint,
smallint
or
int
The parameter can either be a
column name,
a variable,
a constant
or an
expression.
Example for the string function char()
select char(42)
go
-----
*
Returns the character "*".
Format query output using the char() function
By using the feature char(10) (tabulator) and char(9)(line feed), the char() function can be used to format the output of a query.
select
name
+ char(9)
+ phyname
+ char(9)
+ convert(varchar, low/16777216)
as "name physical_name vdevno"
from sysdevices
where name = "data01"
go
-----
data01 /dev/vx/rdsk/disk_group/data01 51
Returns the result as a string of datatype varchar and adds a tabulator between each "column".
select
name
+ char(10)
+ phyname
+ char(10)
+ convert(varchar, low/16777216)
as "name physical_name vdevno"
from sysdevices
where name = "data01"
go
-----
data01
/dev/vx/rdsk/disk_group/data01
51
Returns the result as a string of datatype varchar and adds a line feed between each "Spalten".
See also:
ASE T-SQL - Aggregate Functions, ascii(), char(n), charindex(), char_length(), compare(), difference(), lower(), ltrim(), patindex(), replicate(), reverse(), right(), rtrim(), sortkey(), soundex(), space(), str(), String Functions, stuff(), substring(), to_unichar(), uhighsurr(), ulowsurr(), upper(), uscalar().
|