您现在的位置: > 技术沙龙 > 数据库 > SQL Server > Transact-SQL 参考 > RTRIM
  • 相关软件
    >RTRIM 创建者:webmaster 更新时间:2006-02-16 15:51

    截断所有尾随空格后返回一个字符串。



    语法


    RTRIM ( character_expression )



    参数


    character_expression



    由字符数据组成的表达式。character_expression 可以是常量、变量,也可以是字符或二进制数据的列。



    返回类型


    varchar



    注释


    character_expression 必须为可隐性转换为 varchar 的数据类型。否则请使用 CAST 函数显式转换 character_expression



    说明  兼容级别可能影响返回值。有关更多信息,请参见 sp_dbcmptlevel



    示例


    下例显示如何使用 RTRIM 删除字符变量中的尾随空格。



    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


    下面是结果集:



    (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)
    相关文章
    本页查看次数: