Friday, 22 April 2016

Use of LTRIM and RTRIM function in SQL server ?

LTRIM FUNCTION
LTRIM function is used to remove the leading blanks(i.e towards right side) from the character expression

Syntax:
LTRIM(CHARACTER EXPRESSION)

Example:
SELECT LTRIM('           SQL SERVER')

Output:
SQL SERVER

RTRIM FUNCTION
RTRIM function is used to remove the trailing blanks(i.e towards left side) from the character expression

Syntax:
RTRIM(CHARACTER EXPRESSION)

Example:
SELECT RTRIM('SQL SERVER                ')

Output:
SQL SERVER

No comments:

Post a Comment