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'鵽'
union all select 'E',N'樲'
union all select 'F',N'鰒'
union all select 'G',N'腂'
union all select 'H',N'夻'
union all select 'J',N'攈'
union all select 'K',N'穒'
union all select 'L',N'鱳'
union all select 'M',N'旀'
union all select 'N',N'桛'
union all select 'O',N'漚'
union all select 'P',N'曝'
union all select 'Q',N'囕'
union all select 'R',N'鶸'
union all select 'S',N'蜶'
union all select 'T',N'籜'
union all select 'W',N'鶩'
union all select 'X',N'鑂'
union all select 'Y',N'韻'
union all select 'Z',N'咗'
) T
where word>=@word collate Chinese_PRC_CS_AS_KS_WS
order by PY ASC) else @word end)
set @str=right(@str,len(@str)-1)
end
return @PY
end
exec dbo.fun_getPY('中华人民共和国')
分享到:
相关推荐
VB汉字提取拼音首字母实例函数,测试直接可以使用,包括了大部分汉字
取汉字拼音首字母的函数,取汉字拼音首字母的函数,取汉字拼音首字母的函数
用PB写的获取汉字拼音首字母函数,也就是汉字拼音的声母.
支持2万+汉字转拼音首字母
Oracle汉字拼音首字母函数
使用MySQL函数,实现获取汉字拼音首字母。在SQL语句中传入汉字返回对应的首字母
oracle获取汉字拼音拼音首字母的功能函数 oracle 获取汉字拼音
输入汉字字符参数,返回汉字拼音的首字母!
取汉字拼音首字母的自定义EXCEL函数.取汉字拼音首字母的自定义EXCEL函数.
微信小程序-汉字拼音首字母排序选择,包括了一个微信小程序富文本解析函数库,收录字符的Unicode编码范围为19968至40869,汉字拼音首字母列表 本列表包含了20902个汉字,用于配合 ToChineseSpell,改动为判定输入数组...
postgresql汉字转拼音首字母函数,用于批量生成助记码、拼音码,包含两万多个汉字。
Oracle获取汉字拼音和拼音首字母的功能函数
Oracle查询取汉字拼音首字母Function
【Access源码示例】--汉字转拼音首字母大写、转完整拼音
utf8编码汉字获取首字母,去掉ConvertGBKToUtf8(ch);函数和引用库,ASCII编码汉字也可获取拼音首字母,第一个cpp是所有汉字可以获取首字母,第二个cpp仅针对常用汉字可用的c++获取汉字首字母
pb函数拼音首字母
根据,您在一个查询页面中,输入的汉字字符串,获取其对应的汉字拼音首字母字符串,并灵活配置到其他id中
Mysql 汉字转拼音首字母,使用方式: 运行后生成一个表 一个函数 ,SELECT getPY("龍的传人");查询结果为LDCR。 不支持多音字。
利用excel中的宏工具可以方便的提取汉字的拼音首字母,此代码为宏函数
NULL 博文链接:https://yeminping.iteye.com/blog/573438