if object_id('dbo.get_china_str')is not null drop function dbo.get_china_str go create function dbo.get_china_str ( @str nvarchar(200) ) returns nvarchar(200) as begin declare @i int set @i=1 while @i<=len(@str) begin if len(unicode(substring(@str,@i,1)))<5 begin set @str=stuff(@str,@i,1,''); end else set @i=@i+1; end return @str end go select dbo.get_china_str(N'UNION ALL SELECT 我们都是中国人,都是炎黄子孙,都是龙人传人')