SQL TRIM() function
In SQL server there is no inbuilt trim function, but we have inbuilt LTRIM() & RTRIM() functions. LTRIM() function will trim the left side (leading)spaces and RTRIM() function will remove right side(trailing) spaces in a string. So by using inbuilt LTRIM() & RTRIM() function we can write the user define TRIM() function to trim the leading and trailing spaces in a string.
Using in SELECT statement