快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

取汉字拼音首字母的存储过程

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\\\'?z\\\'
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\\\'?h\\\'
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\\\'?a\\\'
union all select \\\'P\\\',N\\\'曝\\\'
union all select \\\'Q\\\',N\\\'?蒈\\'
union all select \\\'R\\\',N\\\'?U\\\'
union all select \\\'S\\\',N\\\'我\\\'
union all select \\\'T\\\',N\\\'回\\\'
union all select \\\'W\\\',N\\\'?F\\\'
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
返回类别: 教程
上一教程: 用SQL SERVER为WEB浏览器提供图像(一)
下一教程: 在SELECT语句中使用TOP的一些小技巧

您可以阅读与"取汉字拼音首字母的存储过程"相关的教程:
· 取汉字拼音首字母的存储过程
· 取得拼音字头的存储过程
· 将表数据生成SQL脚本的存储过程
· 将表数据生成SQL脚本的存储过程
· 关于值班治理的存储过程
    微笑服务 优质保证 索取样品