Replace Duplicate Spaces with Single Space in T-SQL
T-SQL code (working in SQL Server) to replace duplicate spaces (or triple or more) with a single space is : declare @text varchar(max) set @text=’ St Charles’ while charindex(‘ ‘,@text)>0 set @text=replace(@text,’ ‘,’ ‘) select @text and the result is : St Charles