楼上的方法可以满足行值是单一的中文或数字,如果是两者混合的如:“我的111”,要筛选,可以采用下面的函数:
create function getNOnumeric(@a varchar(50))
returns varchar(50)
as
/*
函数功能去掉数字和空格
可扩展为:去掉中文,英文等。
*/
begin
declare @int int,@newstr varchar(50)
select @a=reverse(@a)
select @newstr=''
select @int=len(@a)
while @int>0
begin
if ((ascii(@a)<48 or ascii(@a)>57) and ascii(@a)<>32)
select @newstr=@newstr+left(@a,1)
select @a=stuff(@a,1,1,'')
select @int=@int-1
end
select @newstr=reverse(@newstr)
return @newstr
end