In this step by step SQL Tutorial I will show you how to use LTRIM function. For the purpose of this tutorial I will use SQL Server 2012.
Other Versions of SQL Server:
- SQL Server 2012
- This blog post has been written using SQL Server 2012
- SQL Server 2008 / R2
- The examples we used should work in SQL Server 2008 and R2
- SQL Server 2005
- We suspect that this will work in SQL Server 2005 as well
LTRIM Function - returns a string value after removing any spaces from the left side of the specified string.
LTRIM (<<String Value>>)
<<String Value>> - Provide string value (field name or expression) that will be used as your input.
In this example I will declare variable to present my example.
In this example I will show you how to use LTRIM to remove empty space from the left side of the string. In first column you can see string with space at the begging and end. The second column StringWithNoSpaceOnTheLeft you can see that i use function LTRIM() to remove the space from the left.
I hope that will help