SQL Server 查询语句提取中文内容
时间:2010-10-26 来源:Peter_xpp

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+@word
set @str=right(@str,len(@str)-1)
end
return @CN
end
select dbo.fun_getCN('ASDKG论坛KDL')
论坛
select dbo.fun_getCN('ASDKG論壇KDL')
論壇
select dbo.fun_getCN('ASDKDL')
空字符串
相关阅读 更多 +