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.
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)