sqlserver 替换非字母数字汉字函数
create function getStr(@s nvarchar(4000)) returns nvarchar(500)
as
begin
declare @i int
while patindex('%[^0-9,^a-z,^A-Z,^阿-座,^'+char(32)+']%',@s)>0
begin
set @i=patindex('%[^0-9,^a-z,^A-Z,^阿-座,^'+char(32)+']%',@s)
set @s=stuff(@s,@i,1,' ')
end
set @s=replace(@s,'^','')
set @s=replace(@s,' ','')
return @s
end