拼音函数
来源:互联网 发布:织梦cms5.7使用手册 编辑:程序博客网 时间:2024/03/29 21:51
create function fGetPy(@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 = '吖'
union all select '八'
union all select '嚓'
union all select '咑'
union all select '妸'
union all select '发'
union all select '旮'
union all select '铪'
union all select '丌'
--because have no 'i'
union all select '丌'
union all select '咔'
union all select '垃'
union all select '嘸'
union all select '拏'
union all select '噢'
union all select '妑'
union all select '七'
union all select '呥'
union all select '仨'
union all select '他'
union all select '屲' --no 'u'
union all select '屲' --no 'v'
union all select '屲'
union all select '夕'
union all select '丫'
union all select '帀'
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
go
--测试
select dbo.fgetpy('魏保光') as 姓名拼音,dbo.fgetpy('ab中c国人') as 中国人
select dbo.fgetpy('刘子良') as 姓名拼音,dbo.fgetpy('ab中c国人') as 中国人
select dbo.fgetpy('吴过') as 姓名拼音,dbo.fgetpy('ab中c国人') as 中国人
select dbo.fgetpy('东北') as 姓名拼音,dbo.fgetpy('ab中c国人') as 中国人
--删除拼音函数
drop function fgetpy
- 拼音函数
- 获取拼音首字母函数
- sql拼音码函数
- 获取拼音首字母函数
- 汉字转拼音函数
- 获取拼音的函数
- 汉字转拼音函数
- 中文拼音函数
- SQL 拼音搜索函数
- 汉字转换拼音函数
- ASP汉字转拼音函数
- php汉字转拼音函数
- ASP汉字转拼音函数
- php汉字转拼音函数
- ASP汉字转拼音函数
- 得到拼音码的函数
- 文转拼音函数asp
- 中文转拼音函数php
- .NET4.0并行计算技术基础(11)
- jspSmartUpload
- 求职向考官提出十个漂亮问题
- Java Web2.0架构开发与项目实战图书当当网购书http://product.dangdang.com/product.aspx?product_id=20697597
- 小公司的软件产品运营难题
- 拼音函数
- build.xml
- 嵌入式系统设计师08部分总结
- 重写 equals
- 09百度笔试试题(转)
- 了解
- 关于搜索的小问题
- windows xp vc 内存检测工具 Visual Leak Detector
- Java核心API需要掌握的程度{转载}