TRIM() — Returns a string with leading and/or training spaces removed.
TRIM( [[ LEADING | TRAILING | BOTH ] [character] FROM] string-expression )
The TRIM() function returns a string with leading and/or trailing spaces removed. By default, the TRIM function removes spaces from both the beginning and end of the string. If you specify the LEADING or TRAILING clause, spaces are removed from either the beginning or end of the string only.
You can also specify an alternate character to remove. By default only spaces (UTF-8 character code 32) are removed. If you specify a different character, only that character will be removed. For example, the following INSERT statement uses the TRIM function to remove any TAB characters from the beginning of the string input for the ADDRESS column:
INSERT INTO Customers (first, last, address) VALUES(?, ?, TRIM( LEADING CHAR(9) FROM CAST(? AS VARCHAR) ) );