I have one input string 'abcdefg,,,,,,,ghijk,,,,,lmno' and we want an output of 'abcdefg,ghijk,lmno' in SQL Server.
Asked
Active
Viewed 239 times
1 Answers
1
Based on this solution you can replace multiple ,
with a single ,
like this:
SELECT REPLACE(REPLACE(REPLACE('abcdefg,,,,,,,ghijk,,,,,lmno', ',', '<>'), '><', ''), '<>', ',')

Sebastian Brosch
- 42,106
- 15
- 72
- 87