String Functions and Operators

Basic string functions and operators offer a number of capabilities and return a string value as a result. Some string functions are dyadic, indicating that they operate on two strings at once. SQL2003 supports the string functions listed in Table 4-9.

Table 4-9. SQL String functions and operators

Function or operator

Usage

Concatenation operator

Appends two or more literal string expressions, column values, or variables together into one string.

CONVERT

Converts a string to a different representation within the same character set.

LOWER

Converts a string to all lowercase characters.

OVERLAY

Returns the result of replacing a substring of one string with another.

SUBSTRING

Returns a portion of a string.

TRANSLATE

Converts a string from one character set to another.

TRIM

Removes leading characters, trailing characters, or both from a character string.

UPPER

Converts a string to all uppercase characters.

Get SQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.