IT猫扑网:您身边最放心的安全下载站! 最新更新| 软件分类| 专题汇总| 手机版

您当前所在位置:IT猫扑网 > 数据库 > MSSQL > SQL Server取汉字拼音的函数展示

SQL Server取汉字拼音的函数展示

时间:2015-06-28 00:00 来源:IT猫扑网|http://www.itmop.com/ 作者:网管联盟 我要评论(0)

此文章主要介绍的是sql server取汉字拼音的函数,如果你对SQL Server取汉字拼音的函数心存好奇的话,以下的文章将会揭开它的神秘面纱,以下就是文章的详细内容介绍,望大家借鉴。

  1. Create function fun_getPY   
  2. (   
  3. @str nvarchar(4000)   
  4. )   
  5. returns nvarchar(4000)   
  6. as   
  7. begin   
  8. declare @word nchar(1),@PY nvarchar(4000)   
  9. set @PY=''   
  10. while len(@str)>0   
  11. begin   
  12. set @word=left(@str,1)   

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

  1. set @PY=@PY+(case when unicode(@word) between 19968 and 19968+20901   
  2. then (   
  3. select top 1 PY   
  4. from   
  5. (   
  6. select 'A' as PY,N'驁' as word   
  7. union all select 'B',N'簿'   
  8. union all select 'C',N'錯'   
  9. union all select 'D',N'鵽'   
  10. union all select 'E',N'樲'   
  11. union all select 'F',N'鰒'   
  12. union all select 'G',N'腂'   
  13. union all select 'H',N'夻'   
  14. union all select 'J',N'攈'   
  15. union all select 'K',N'穒'   
  16. union all select 'L',N'鱳'   
  17. union all select 'M',N'旀'   
  18. union all select 'N',N'桛'   
  19. union all select 'O',N'漚'   
  20. union all select 'P',N'曝'   
  21. union all select 'Q',N'囕'   
  22. union all select 'R',N'鶸'   
  23. union all select 'S',N'蜶'   
  24. union all select 'T',N'籜'   
  25. union all select 'W',N'鶩'   
  26. union all select 'X',N'鑂'   
  27. union all select 'Y',N'韻'   
  28. union all select 'Z',N'咗'   
  29. ) T   
  30. where word>=@word collate Chinese_PRC_CS_AS_KS_WS   
  31. order by PY ASC   
  32. )   
  33. else @word   
  34. end)   
  35. set @str=right(@str,len(@str)-1)   
  36. end   
  37. return @PY   
  38. end  

以上的相关内容就是对SQL Server取汉字拼音的函数的介绍,望你能有所收获。

关键词标签:SQL Server

相关阅读 sql server系统表损坏的解决方法 SQL Server asp.net 数据提供程序连接池 SqlServer2005对现有数据进行分区具体步骤 一个Access数据库数据传递的实例方法 为导入文件加上时间戳标记的两种方法 SQL Server 2005 在不允许远程连接的情况下的破解

文章评论
发表评论

热门文章 sql server系统表损坏的解决方法 sql server系统表损坏的解决方法 SqlServer2005对现有数据进行分区具体步骤 SqlServer2005对现有数据进行分区具体步骤 解决SQL Server中Group无法实现的问题 解决SQL Server中Group无法实现的问题 SQL Server 2005降级到2000的正确操作步骤 SQL Server 2005降级到2000的正确操作步骤 手把手教你学会SQL Server镜像操作 手把手教你学会SQL Server镜像操作 实战手记:让百万级数据瞬间导入SQL Server 实战手记:让百万级数据瞬间导入SQL Server

相关下载

人气排行 配置和注册ODBC数据源-odbc数据源配置教程 如何远程备份(还原)SQL2000数据库 SQL2000数据库远程导入(导出)数据 SQL2000和SQL2005数据库服务端口查看或修改 修改Sql Server唯一约束教程 SQL Server 2005降级到2000的正确操作步骤 sql server系统表损坏的解决方法 浅谈JSP JDBC来连接SQL Server 2005的方法 SQL Server创建表语句介绍 MS-SQL2005服务器登录名、角色、数据库用户、角色、架构的关系 如何使用SQL Server中的客户端配置工具 SQL Server 分布式查询:OLE DB连接(一)