clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 1228855 fiddles created (16654 in the last week).

CREATE TABLE numbers ( id INT ); INSERT INTO numbers VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
10 rows affected
 hidden batch(es)


CREATE FUNCTION dbo.MultiReplace(@ReplaceTarget NVARCHAR(MAX), @from_chars NVARCHAR(MAX), @to_chars NVARCHAR(MAX)) RETURNS NVARCHAR(MAX) AS BEGIN --Quirky Update: One of the rare situations where this is a good idea SELECT @ReplaceTarget=REPLACE(@ReplaceTarget,SUBSTRING(@from_chars, id+1, 1), SUBSTRING(@to_chars, id+1, 1)) FROM numbers WHERE id < LEN(@from_chars) AND id < LEN(@to_chars) ORDER BY id; RETURN @ReplaceTarget; END
 hidden batch(es)


SELECT dbo.MultiReplace(N'abc\defghijklmnopqrstuvw\x\xyz\\', N'cba', N'dcb');
(No column name)
bcd\defghijklmnopqrstuvw\x\xyz\\
 hidden batch(es)