惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
GbyAI
GbyAI
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
U
Unit 42
Engineering at Meta
Engineering at Meta
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
Vercel News
Vercel News
美团技术团队
雷峰网
雷峰网
Recent Announcements
Recent Announcements
有赞技术团队
有赞技术团队
D
DataBreaches.Net
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
罗磊的独立博客
MyScale Blog
MyScale Blog
博客园_首页
IT之家
IT之家
F
Fortinet All Blogs
博客园 - Franky

博客园 - ssihc

MySql 编码设置 一键设置JDK环境变量 一键java_home&tomcat_home MyEclipse 优化 - ssihc - 博客园 ECShop flash 相册 - ssihc shell SqliteHelper - ssihc - 博客园 C# SQLite - ssihc - 博客园 将资源文件中的数据写回磁盘 获取下级用户列表 备份数据库 获取SQL Server数据库元数据的方法 通用分页存储过程3 通用分页存储过程4 通用分页存储过程2 通用分页存储过程1 列转字符串 选择不是最小的所有记录 实现split功能 的函数
获取整串汉字字符的所有首字母
ssihc · 2009-02-16 · via 博客园 - ssihc

    Create function [dbo].[Fun_GetPY]
     (
        
@str nvarchar(4000),
        
@rstat bit
     )
    
returns nvarchar(4000)
    
as
    
begindeclare @word nchar(1),@PY nvarchar(4000)set @PY=''while len(@str)>0
      
begin
        
set @word=left(@str,1)--如果非汉字字符,返回原字符
        set @PY=@PY+(case when unicode(@wordbetween 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''
                 
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''
                 
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''
                 
union all select 'P',N''
                 
union all select 'Q',N''
                 
union all select 'R',N''
                 
union all select 'S',N''
                 
union all select 'T',N''
                 
union all select 'W',N''
                 
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)
        
if @rstat = 0
          
break
      
endreturn @PYend
    
GO