SQL Replace multiple different characters in string

coblenski picture coblenski · Aug 30, 2016 · Viewed 71.8k times · Source

I need to replace multiple characters in a string. The result can't contain any '&' or any commas.

I currently have:

REPLACE(T2.[ShipToCode],'&','and')

But how do you put multiple values in?

Many thanks!

Answer

Siyual picture Siyual · Aug 30, 2016

You just need to daisy-chain them:

REPLACE(REPLACE(T2.[ShipToCode], '&', 'and'), ',', '')