The TRIM function in SQL Server is used to remove white spaces.
There are 3 types of TRIM:
1)TRIM(<InputString>) - Removes white spaces from both left and right side of the input string.
2)LTRIM(<InputString>) - Remove white spaces from left side of the input string.
3)RTRIM(<InputString>) - Removes white spaces from right side of the input string.
Type | Query | Output |
---|---|---|
TRIM | SELECT TRIM(' Hello ') | Hello |
LTRIM | SELECT TRIM(' Hello') | Hello |
RTRIM | SELECT TRIM('Hello ') | Hello |
No comments:
Post a Comment