By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
declare @s varchar(200) = '___! My name is ___. I am ___ to see you!'
declare @t table
(
rowid int,
thetext varchar(20)
);
insert into @t(rowid, thetext)
values (1, 'Hello'), (2, 'PrinceTyke'), (3, 'happy');
select @s = stuff(@s, charindex('___', @s), len('___') , thetext)
from @t
order by rowid;
select @s;
(No column name) |
---|
Hello! My name is PrinceTyke. I am happy to see you! |