A varchar(100) column may contain zero or more commas anywhere in the string.
For each comma, if the previous character is a digit 0-9 and the following character is a digit 0-9, then remove the comma, otherwise replace the comma with a space.
If the column contains zero commas, pass the unchanged column value through. Examples:
Code: Select all
"$321.00 4 5" becomes "$321.00 4 5" (unchanged)
"1,234 miles" becomes "1234 miles"
"Lets eat, grandpa!" becomes "Let's eat grandpa!"
"Area 5, Sections 6,7,8,,9" becomes "Area 5 Sections 678 9"
",Parts A,B,C," becomes " Parts A B C "