Replacing multiple spaces with a single space
967562Feb 5 2013 — edited May 16 2013Hi friends,
I have a string. It can have zero/one/multiple spaces. I want to make the multiple spaces to single space.
Here are the cases:
1. ' a b c d efg h' should be changed to 'a b c d e f g h'
2. ' a b c d e f g h ' should be changed to 'a b c d e f g h'
3. 'a b c d e f g h' should not be changed
4. 'abcdefgh' should not be changed
Both REPLACE and TRANSLATE do not help. I don't want to go for LOOP logic. Please help me to get it in SQL query.
Thanks in advance!