Icon TRIM

Removes repetitions of a specified character from the left, right, or both sides of a string.

Syntax
TRIM(LEADING|TRAILING|BOTH <CharacterExpression>
     FROM <StringExpression>)
TRIM(LEADING|TRAILING|BOTH <CharacterExpression>,
     <StringExpression>)

<StringExpression> = 

Type of:

CHARACTER|CHAR
CHARACTER VARYING|VARCHAR
GUID
CHARACTER LARGE OBJECT|CLOB

Returns
Same as input

Usage
The TRIM function removes any repetitions of the specified trailing or leading character, or both, from a string. The first parameter indicates the position of the character to be deleted, and has one of the following values:

KeywordDescription
LEADINGDeletes the character in the leading portion of the string.
TRAILINGDeletes the character in the trailing portion of the string.
BOTHDeletes the character at both ends of the string.

The character parameter specifies the character to be deleted.

The FROM parameter specifies the string value to trim.

Examples
SELECT TRIM(TRAILING ' ' FROM CustomerID) AS CustomerID
FROM Customers

SQL 2003 Standard Deviations
This function deviates from the SQL 2003 standard in the following ways:

DeviationDetails
Argument SeparatorThe use of a comma separator for the function arguments is an ElevateDB extension.
Image