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
Using the EMPLOYEE table, select the job description (JOB defined as CHAR(8))
for Dolores Quintana as a VARCHAR equivelant:
SELECT VARCHAR(JOB)
FROM EMPLOYEE
WHERE LASTNAME = 'QUINTANA'