LTRIM (Transact-SQL)
SQL Server 2008 R2
Devuelve una expresión de caracteres tras quitar todos los espacios iniciales en blanco.
Los niveles de compatibilidad pueden afectar a los valores devueltos. Para obtener más información acerca de los niveles de compatibilidad, vea sp_dbcmptlevel (Transact-SQL).
En el siguiente ejemplo se utiliza LTRIM para quitar espacios iniciales de una variable de caracteres.
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
El conjunto de resultados es el siguiente.
------------------------------------------------------------------------ Here is the string without the leading spaces: Five spaces are at the beginning of this string. (1 row(s) affected)