求一个汉字转拼音的函数,多谢!
ALTER function [dbo].[FunGetPy](@Str varchar(500)='')
returns varchar(500)
as
begin
declare @strlen int,@return varchar(500),@ii int
declare @n int,@c char(1),@chn nchar(1)
select @strlen=len(@str),@return='',@ii=0
set @ii=0
while @ii<@strlen
begin
select @ii=@ii+1,@n=63,@chn=substring(@str,@ii,1)
if @chn>'z'
select @n = @n +1
,@c = case chn when @chn then char(@n) else @c end
from(
select top 27 * from (
select chn = N'吖'
union all select N'八'
union all select N'嚓'
union all select N'咑'
union all select N'妸'
union all select N'发'
union all select N'旮'
union all select N'铪'
union all select N'丌' --because have no 'i'
union all select N'丌'
union all select N'咔'
union all select N'垃'
union all select N'嘸'
union all select N'拏'
union all select N'噢'
union all select N'妑'
union all select N'七'
union all select N'呥'
union all select N'仨'
union all select N'他'
union all select N'屲' --no 'u'
union all select N'屲' --no 'v'
union all select N'屲'
union all select N'夕'
union all select N'丫'
union all select N'帀'
union all select @chn) as a
order by chn COLLATE Chinese_PRC_CI_AS
) as b
else set @c='a'
set @return=@return+@c
end
return(@return)
end
这个不行啊
Select dbo.FunGetPy('行')
/*
------------------------------------------------
X
(1 行受影响)
//居然是X,而不是H....
*/
...全文
相关推荐
汉字转拼音(全拼)Oracle函数
"该资源提供了一个Oracle数据库中的自定义函数,用于将汉字转换为全拼。函数通过处理特定编码来快速获取汉字的拼音首字母,适用于快速查询和搜索功能,如输入拼音查找对应的汉字信息。"在Oracle
oracle汉字转拼音函数整理大全
### Oracle汉字转拼音函数知识点详解#### 一、概述在Oracle数据库中,有时需要将汉字转换成拼音,尤其是在处理中文数据时。
VB汉字转拼音函数代码
下面是一个简单的汉字转拼音函数的实现思路:1. **获取汉字的Unicode值**:使用`AscW()`函数,例如`unicodeValue = AscW("漢")`。2.
js汉字转拼音及汉字转拼音首字母
py.js"则很可能是一个JavaScript库,用于处理汉字转拼音和拼音首字母的逻辑。在"py.js"中,可能会有以下核心函数:1.
C++ 汉字转拼音源码
`.cpp`文件通常包含实际的函数实现,而`.h`文件则包含了函数的声明,可能还包括一些常量定义和数据结构。开发者可以通过这两个文件来理解和使用这个汉字转拼音的库。


