ALTER function [dbo].Fn_ReplaceSpecialChar)
    returns nvarchar(4000)
    AS
    begin
    declare @word nchar(1),@PY nvarchar(4000)
    set @str=rtrim(ltrim(@str))
    set @PY=’’
    while len(@str)>0
    begin
    set @word=left(@str,1)
    —如果非汉字字符,返回原字符
    set @PY = @PY + (case
    when @word in (‘(‘,’)’,’(’,’)’,’!’,’@’,’#’,’$’,’%’,’^’,’&’,’*’,’+’,’;’,’;’,’?’,’< ‘,’>’,’‘’,’’’,’,’,’-‘,’_’,’\’,’/‘) then ‘’
    else @word end)
    set @str=right(@str,len(@str)-1)
    end
    return replace(@PY,nchar(32),’’)
    end