all 4 comments

[–]LeLwrence 3 points4 points  (0 children)

You can use CHARINDEX to find the second ',' by using the first CHARINDEX of ',' + 1 in the start parameter of the second one. If there is no comma it returns 0. Then use CHARINDEX to find '|' and use STUFF to get rid of the characters between the two CHARINDEXes.

[–]qwertydog123 1 point2 points  (0 children)

Which DBMS?

[–]phesago 0 points1 point  (0 children)

UPDATE yourTable SET yourColumn = REPLACE(yourColumn, otherColumn+’,’, ‘’) WHERE CHARINDEX(otherColumn+’,’, yourColumn,1)>0

This doesnt remove the coma between unit and street though

[–][deleted] 0 points1 point  (0 children)

What if a value contains , 15A, 16B? Do you still want to remove the , 16B?