update 表名 set code=replace(code,'sa','as') where [id]='as'
create table test050202(item int,test nvarchar(10) null) insert into test050202 select 1,null union all select 2,'sa0001' update test050202 set test=stuff(test,charindex('sa',test),2,'as') where item=2select * from test050202 drop table test050202
set code=replace(code,'sa','as')
where [id]='as'
insert into test050202
select 1,null union all select 2,'sa0001'
update test050202
set test=stuff(test,charindex('sa',test),2,'as')
where item=2select * from test050202
drop table test050202