The LTRIM() and RTRIM() Functions : LTRIM « String Functions « SQL Server / T-SQL Tutorial






4> DECLARE @Value1 Char(10), @Value2 Char(10) SET @Value1 = 'One'
5> SET @Value2 = 'Two'
6> SELECT @Value1 + @Value2
7> SELECT CONVERT(VarChar(5), LEN(@Value1 + @Value2)) + ' characters long.'
8> SELECT RTRIM(@Value1) + RTRIM(@Value2)
9> SELECT CONVERT(VarChar(5), LEN(RTRIM(@Value1) + RTRIM(@Value2)))
10>  ' characters long trimmed.'
11> GO

--------------------
One       Two

(1 rows affected)

----------------------
13 characters long.

(1 rows affected)

--------------------
OneTwo

(1 rows affected)
 characters long trimmed.
-------------------------
6

(1 rows affected)








12.9.LTRIM
12.9.1.LTRIM Removes leading spaces from a string.
12.9.2.The LTRIM() and RTRIM() Functions
12.9.3.Removing Leading Blanks
12.9.4.select LTRIM(' SQL Server ')