Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > MS SQL Server > удаление пробелов в начале строки


Автор: Lexx 18.12.2006, 08:47
SQL Server 2000
Delphi 7
ADO

Как в запросе описать условие на удаление первых пробелов если они имеются?
Заранее благодарен!!!

Автор: Dremlin 18.12.2006, 09:41
Цитата

LTRIM
Returns a character expression after removing leading blanks.

Syntax
LTRIM ( character_expression ) 

Arguments
character_expression

Is an expression of character or binary data. character_expression can be a constant, variable, or column. character_expression must be of a data type that is implicitly convertible to varchar. Otherwise, use CAST to explicitly convert character_expression.

Return Type
varchar

Remarks
Compatibility levels can affect return values. For more information about compatibility levels, see sp_dbcmptlevel. 

Examples
This example uses LTRIM to remove leading spaces from a character variable.

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 result set:

------------------------------------------------------------------------
Here is the string without the leading spaces: Five spaces are at the beginning of this string.             

(1 row(s) affected)



нейжели так трудно заглянуть в хелп?

Автор: Lexx 19.12.2006, 08:56
Спасибо (bookson-line рулит)

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)