Export (0) Print
Expand All
ABS
ALL
AND
ANY
AVG
bit
COS
COT
DAY
EXP
GO
IN
LEN
LOG
MAX
MIN
NOT
OR
PI
SET
SIN
STR
SUM
TAN
USE
VAR
Expand Minimize

RTRIM

SQL Server 2000

Returns a character string after truncating all trailing blanks.

Syntax

RTRIM ( character_expression )

Arguments

character_expression

Is an expression of character data. character_expression can be a constant, variable, or column of either character or binary data.

Return Types

varchar

Remarks

character_expression must be of a data type that is implicitly convertible to varchar. Otherwise, use the CAST function to explicitly convert character_expression.

Note  Compatibility levels can affect return values. For more information, see sp_dbcmptlevel.

Examples

This example demonstrates how to use RTRIM to remove trailing spaces from a character variable.

DECLARE @string_to_trim varchar(60)
SET @string_to_trim = 'Four spaces are after the period in this sentence.    '
SELECT 'Here is the string without the leading spaces: ' + CHAR(13) +
   RTRIM(@string_to_trim)
GO

Here is the result set:

(1 row(s) affected)
------------------------------------------------------------------------ 
Here is the string without the leading spaces: Four spaces are after the period in this sentence.           
(1 row(s) affected)

See Also

CAST and CONVERT

Data Types

String Functions

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft