trim the spaces in sql server code example Example 1: sql trim all spaces Select TRIM (' Word ') Example 2: remove spaces sql 2008 SELECT RTRIM(LTRIM(' Word '))