LTRIM: trim the white space to the left
12>
13>
14> -- LTRIM() and RTRIM() Functions
15>
16> -- Return a string with white space (spaces) trimmed
17>
18> DECLARE @Value1 Char(10), @Value2 Char(10) SET @Value1 = 'One'
19> SET @Value2 = 'Two'
20> SELECT @Value1 + @Value2
21> SELECT CONVERT(VarChar(5), LEN(@Value1 + @Value2)) + ' characters long.'
22> SELECT RTRIM(@Value1) + RTRIM(@Value2)
23> SELECT CONVERT(VarChar(5), LEN(RTRIM(@Value1) + RTRIM(@Value2)))
24> + ' characters long trimmed.'
25> GO
--------------------
One Two
(1 rows affected)
----------------------
13 characters long.
(1 rows affected)
--------------------
OneTwo
(1 rows affected)
------------------------------
6 characters long trimmed.
(1 rows affected)
1>
2>
Related examples in the same category