I have a text column varchar(4000) with text:
'aaabbaaacbaaaccc'
and I need to remove all duplicated chars - so only one from sequence left:
'abacbac'
It should not be a function, Procedure or CLR - Regex solution. Only true SQL select.
Currently I think about using recursive WITH clause with replace 'aa'->'a', 'bb'->'b', 'cc'->'c'.
So recursion should cycle until all duplicated sequences of that chars would be replaced.
Do you have another solution, perhaps more performant one?
PS: I searched through this site about different replace examples - they didn't suit to this case.