34,838
社区成员




create function f_str(@str varchar(400))
returns varchar(400)
as
begin
while patindex('%[0-9]%',@str)>0
begin
set @str = stuff( @str, patindex('%[0-9]%',@str) ,1 ,'')
end
return @str
end
go
declare @s varchar(100)
set @s = '3a11n34sH789il010v99l'
select dbo.f_str(@s)
go
drop function f_str
/*
-------------
ansHilvl
(所影响的行数为 1 行)
*/
declare @Str varchar(100)
set @Str = '333333a11n34sH78123321i10C741h85u21NL0v999999'
select @Str = replace(@Str, num, '') from
(
select 0 num union all
select 1 num union all
select 2 num union all
select 3 num union all
select 4 num union all
select 5 num union all
select 6 num union all
select 7 num union all
select 8 num union all
select 9 num
) a
select @Str