While checking this page it came to my attention that to replacing all the double spaces from the database you might have triple space or more on the single record.
The thing that the some solution didn't take in consideration.So you need to make sure that your statement replace them all. Doing one time or two time replacement of double space with single space might not cover all the corrupted data.
For example having a record value as 'A B C'
; what you can do is:
- first replace all the single space with open/closed characters
like
<>
, or []
or {}
...
- Then replace the back to back reversed order characters (closed/open)
with empty value, so all
><
or ][
or }{
will be removed.
- Final step is to restore the single spaces by replacing the remaining open/close
characters with single space, for example
<>
will be changed back to ' '
I always use something like following to fix my data:
UPDATE Table1 SET Column1 = REPLACE(REPLACE(REPLACE(Column1, ' ', '<>'), '><', ''),'<>',' ');