示例輸出
[a b c d]
刪除起始空格后返回字元表達式。
語法 LTRIM (character_expression )
參數 character_expression
是字元或二進位數據表達式。c haracter_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)