Now I can tidy things up and remove both leading and trailing spaces with a single call to TRIM():SELECT TRIM(b.foo) FROM dbo.bar b;
On the surface, this may not seem like that big of a deal. And I would tend to agree. But, in this example, it saves a few key strokes and makes the code slightly more readable. And it is nice for T-SQL to finally have a function that has been around in other languages for far longer than I’ve been writing code for a living.
But Wait, There’s More!
Click through for that more. This makes TRIM a lot more useful, so go check it out.