LTRIM (Transact-SQL)
先頭の空白を削除した後の文字式を返します。
構文
LTRIM ( character_expression )
引数
- character_expression
文字またはバイナリ データの式を指定します。 character_expression には定数、変数、または列を指定できます。 character_expression は、text、ntext、および image の各データ型以外で、varchar 型に暗黙的に変換できるデータ型である必要があります。 暗黙的に変換できない場合は、CAST を使用して character_expression を明示的に変換します。
戻り値の型
varchar またはnvarchar
使用例
次の例では、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)