-- =============================================
-- 功能:汉字转换成拼音首字母 首字母查
-- =============================================
ALTER FUNCTION [dbo].[ufn_GetSpellCode](@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=@chn
set @return=@return+@c
end
return(@return)
end

最新文章

  1. ubuntu server 搭建自己的个人博客及其他网站
  2. C#求任意范围内的质数
  3. Android_TextView之跑马灯效果
  4. mac OS X Yosemite 上编译hadoop 2.6.0/2.7.0及TEZ 0.5.2/0.7.0 注意事项
  5. 奥迪--Q5
  6. c++ 相关的技术资源整理归类
  7. Transact-SQL 示例 - UPDATE中使用INNER JOIN
  8. HDU 4635 Strongly connected(强连通分量,变形)
  9. FtpManager类
  10. Apache James使用的方法及相关心得(转)
  11. 分布式版本控制系统Git-----3.图形化Tortoisegit创建本地库并且提交到远程服务器上
  12. 实践详细篇-Windows下使用VS2015编译的Caffe训练mnist数据集
  13. SSH免密登陆原理及实现
  14. matlab图片 latex显示
  15. BZOJ1423 : Optimus Prime
  16. layer loading层 的设置
  17. iptables 分析(二)
  18. Linux期末总结
  19. PHP 实现 word/excel/ppt 转换为 PDF
  20. bcolz的新操作

热门文章

  1. 查看linux的出错信息
  2. nginx for windows中的一项缺陷
  3. DB2 Unload 的时候遇到B37-04
  4. ubuntu下配置SVN服务器
  5. ImagXpress中如何修改Alpha通道方法汇总
  6. TI CC2541的串口输出.
  7. IEnumerator:概念详解
  8. windows prompt personalize 设置cmd提示的相关
  9. Android系统版本与API Level对照表
  10. linux下对sh文件的操作