删除起始空格后返回字符表达式。
LTRIM ( character_expression )
character_expression
是字符或二进制数据表达式。character_expression 可以是常量、变量或列。character_expression 必须是可以隐性转换为 varchar 的数据类型。否则,使用 CAST 显式转换 character_expression。
varchar
兼容级别可能影响返回值。有关兼容级别的更多信息,请参见 sp_dbcmptlevel。
下例使用 LTRIM 字符删除字符变量中的起始空格。
DECLARE @string_to_trim varchar(60)
SET @string_to_trim = ' Five spaces are at the beginning of this
string.'
SELECT 'Here is the string without the leading spaces: ' +
LTRIM(@string_to_trim)
GO
下面是结果集:
------------------------------------------------------------------------相关文章
Here is the string without the leading spaces: Five spaces are at the beginning of this string.
(1 row(s) affected)