RTRIM (Transact-SQL)
SQL Server 2005
傳回截斷所有尾端空白的字元字串。
相容性層級可能會影響傳回值。如需詳細資訊,請參閱<sp_dbcmptlevel (Transact-SQL)>。
下列範例會示範如何利用 RTRIM 來移除字元變數中的尾端空白。
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
以下為結果集:
------------------------------------------------------------------------- Four spaces are after the period in this sentence. Next string. (1 row(s) affected) ------------------------------------------------------------------------- Four spaces are after the period in this sentence. Next string. (1 row(s) affected)
社群新增項目
新增
顯示:

