REPLACE替换字符串(update)
--地址数字*号
declare @i int
set @i=0
while @i<=9
begin
update db_view set address=REPLACE(address,@i,'*')
set @i=@i+1
end
declare @i int
set @i=0
while @i<=9
begin
update db_view set address=REPLACE(address,@i,'*')
set @i=@i+1
end
--电话号码中间6位*号
update db_view set telcode=REPLACE(telcode,SUBSTRING(telcode,2,6),'******')
update db_view set telcode=REPLACE(telcode,SUBSTRING(telcode,2,6),'******')
--姓名后面2位*号
update db_view set name=REPLACE(name,SUBSTRING(name,2,2),'**')
update db_view set name=REPLACE(name,SUBSTRING(name,2,2),'**')