TRIM

functionsupportedCore SQL functions

docs.snowflake.com ↗

String & binary functions

Removes leading and trailing characters from a string. Note To remove characters in a string, you can use the REPLACE function. See also: LTRIM , RTRIM , String & binary data types

Syntax

supportedpartialnot supportednot scored

TRIM( <expr> [, <characters> ] )

Parameters

NameRequiredDescription
exprrequiredA string expression to be trimmed.
charactersrequiredOne or more characters to remove from the left and right side of expr. The default value is ' ' (a single blank space character). If no characters are specified, only blank spaces are removed.

Returns

This function returns a value of VARCHAR data type or NULL. If either argument is NULL, returns NULL.

Usage notes

Collation details

Collation is supported when the optional second argument is omitted, or when it contains only whitespace. The collation specification of the returned value is the same as the collation specification of the first argument.