create function fun_getCN(@str nvarchar(4000))
returns nvarchar(4000) as begin declare @word nchar(1),@CN nvarchar(4000) set @CN='' while len(@str)>0 begin set @word=left(@str,1) if unicode(@word) between 19968 and 19968+20901 set @CN=@CN+@wordset @str=right(@str,len(@str)-1) end return @CN end
select dbo.fun_getCN('sdsfdfd博客园xcxcxc')
博客园select dbo.fun_getCN('cxxvx发布cxcx')发布select dbo.fun_getCN('cxcXZCzxc')空字符串
http://www.yuqicook.com/post/20101026001.aspx