Every now and then, we encounter data that needs to be cleaned up because it’s got leading and/or trailing spaces. Or maybe you’re storing short data in a
CHAR(N)field, so when you query it, you’re getting trailing spaces. For time immemorial, we’ve had to wrap these fields in
rtrim(ltrim(fieldname))to do the deed.
Effective with SQL Server 2017, that’s no longer the case.
The eight keystrokes add up over time. In all seriousness, I am happy that
TRIM() is a thing in SQL Server 2017. And Andy gives us a little bonus to make it worth your refactoring while.