John Cobby John Cobby - 3 months ago 23
SQL Question

SQL Replace multiple different characters in string

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

You just need to daisy-chain them:

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