展会信息港展会大全

SQL Server编写函数获取汉字的拼音码
来源:互联网   发布日期:2016-02-17 09:44:49   浏览:1953次  

导读: SQL Server编写函数获取汉字的拼音码(首字母) Create function fun_getPY ( @str nvarchar(4000) ) returns nvarc...

SQL Server编写函数获取汉字的拼音码(首字母)

Create function fun_getPY ( @str nvarchar(4000) )

returns nvarchar(4000)

as

begin

declare @word nchar(1),@PY nvarchar(4000)

set @PY=''

while len(@str)>0

begin

set @word=left(@str,1)

--如果非汉字字符,返回原字符

set @PY=@PY+(case when unicode(@word) between 19968 and 19968+20901

then (

select top 1 PY

from

(

select 'A' as PY,N'骜' as word

union all select 'B',N'簿'

union all select 'C',N'错'

union all select 'D',N'

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
推荐内容
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港