How i can replace all chars that are not in specified range of chars?
DECLARE @s VARCHAR(max)
DECLARE @allowedChars VARCHAR(max)
SET @s = 'Foo@Bar !'
SET @allowedChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ$_/+-.0123456789'
SELECT MAGICREPLACE(@s, @allowedChars,'_');
--Should return 'F___B____'