RTRIM: remove trailing spaces from a string : RTRIM « Subquery « SQL Server / T-SQL






RTRIM: remove trailing spaces from a string


1> -- RTRIM: remove trailing spaces from a string.
2>
3>
4> DECLARE @STRING_WITH_SPACES VARCHAR(30)
5> DECLARE @STRING_WITHOUT_SPACES VARCHAR(30)
6> SET @STRING_WITH_SPACES = "www.java2s.com "
7>
8> SET @STRING_WITHOUT_SPACES = RTRIM(@STRING_WITH_SPACES)
9>
10> SELECT @STRING_WITH_SPACES + "!"
11> SELECT @STRING_WITHOUT_SPACES + "!"
12> GO

-------------------------------
www.java2s.com !

(1 rows affected)

-------------------------------
www.java2s.com!

(1 rows affected)
1>
           
       








Related examples in the same category

1.RTRIM: trim string on the right
2.RTRIM: trim the white space to the right
3.RTRIM(city),30)