VARCHAR

The VARCHAR function returns a varying-length character string representation of a character string.

Character to varchar syntax

VARCHAR (CharacterStringExpression ) 

CharacterStringExpression

An expression whose value must be of a character-string data type with a maximum length of 32,672 bytes.

Datetime to varchar syntax

VARCHAR (DatetimeExpression ) 

DatetimeExpression

An expression whose value must be of a date, time, or timestamp data type.

Example

The Position column in our Players table is defined as CHAR(2). The following query show hows to access positon values as VARCHARs:

splice> SELECT VARCHAR(Position)
   FROM Players
   WHERE ID < 11;
1
----
C
1B
2B
SS
3B
LF
CF
RF
OF
RF

10 rows selected

See Also