What is the best way to remove all spaces from a string in SQL Server 2008?
LTRIM(RTRIM(\' a b \')) would remove all spaces at the right and left of th
LTRIM(RTRIM(\' a b \'))
If it is an update on a table all you have to do is run this update multiple times until it is affecting 0 rows.
update tableName set colName = REPLACE(LTRIM(RTRIM(colName)), ' ', ' ') where colName like '% %'