alter table table1 add id int identity(1,1)
go
declare @val varchar(10),@i int,@len int,@tel varchar(2000),@id int
select @val=''
declare ytbelwxg cursor for select id,c from table1
open ytbelwxg
fetch next from ytbelwxg into @id,@tel
while @@fetch_status=0
begin
select @i=1
select @len=len(@tel)
while @i< =@len
begin
select @val=substring(@tel,@i,1)
if isnumeric(@val)=0
update table1 set c= replace(c,@val,'')
select @i=@i+1
end
fetch next from ytbelwxg into @id,@tel
end
close ytbelwxg
deallocate ytbelwxg
go
alter table table1 drop column id
go
select * from table1
用空字符串替换除数字以外的字符
最新推荐文章于 2021-01-18 18:30:29 发布