Question : Remove Spaces in String Variable

Is it possible to have SQL remove a space when it is surrounded by two other spaces but not remove spaces when it's between other characters?

ie:
remove all but one space beteween:
123                  456
so that it appears as
123 456

but leave
456 789
as it is without changing it to
456789

Answer : Remove Spaces in String Variable

Not sure if it'll work but try, replace(col,'  ', ' ')    <- Replace two spaces with one space.  

That way if you start with 3 spaces, it should take the 1st two and make them one space, leaving you with two in a row.  Question is will it take that new space w/ the old space and make it one as well.

Also, you could look into writing a "user defined function" to do this.  You can actually write your own functions similar to replace.
Random Solutions  
 
programming4us programming4us