What is the function of RTRIM? It will returns a character string after truncating all trailing blanks.
For example,
DECLARE @string_to_trim varchar(60);
SET @string_to_trim = ‘Four spaces are after the period in this sentence. ‘;
SELECT @string_to_trim + ‘ Next string.’;
SELECT RTRIM(@string_to_trim) + ‘ Next string.’;
GO
The result == “Four spaces are after the period in this sentence. Next string.“. As you can see, the 4 spaces behind the word ’sentence’ was trim off.
Tags: Transact-SQL
RSS feed for comments on this post · TrackBack URI
Leave a reply