Using TRIM

The TRIM function, as in many other programing languages, removes the space character CHAR(32) from both sides of a given string. There is nothing special with this function, except the fact that implementation did not come until SQL Server 2017, although the LTRIM and RTRIM functions had existed for almost 10 years. Prior to this version, if you wanted to remove white spaces, you had to use the LTRIM(RTRIM(<string>)) expression.

Get SQL Server 2017 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.