Removes leading characters, trailing characters, or both from a character string.
Category: | Character |
Returned data type: | VARCHAR NVARCHAR |
specifies whether to remove the leading characters, the trailing characters, or both.
Default | BOTH |
specifies one character to remove from column. Enclose a literal character in single quotation marks. If trim-character is not specified, the TRIM function trims all blank spaces, not just one character.
Default | Blank |
Data type | CHAR, VARCHAR, NVARCHAR |
is any valid expression that evaluates to a column name.
Statements
|
Results
|
---|---|
select trim(word1) from afewwords; |
*some/ *every* *no* |
select trim(both '*' from word1) from afewwords; |
some every no |
select trim(leading '*' from word1) from afewwords; |
some/ every* no* |
select trim(trailing '*' from word1) from afewwords; |
*some/ *every *no |