|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
曾经的功能列表可能会迅速变得过时了。而且,有些功能对有的应用程序非常重要,但是对别的应用程序则不一定。函数|汉字|拼音|字符串dropfunctionfun_getPY
go
SETQUOTED_IDENTIFIERON
go
SETANSI_NULLSON
go
----取汉字拼音首字母的存储历程
Createfunctionfun_getPY(@strnvarchar(4000))
returnsnvarchar(4000)
as
begin
declare@wordnchar(1),@PYnvarchar(4000)
set@PY=
whilelen(@str)>0
begin
set@word=left(@str,1)
--假如非汉字字符,前往原字符
set@PY=@PY+(casewhenunicode(@word)between19968and19968+20901
then(
selecttop1PY
from
(
selectAasPY,Nasword
unionallselectB,N簿
unionallselectC,Ne
unionallselectD,Nz
unionallselectE,N
unionallselectF,Nv
unionallselectG,NB
unionallselectH,N
unionallselectJ,Nh
unionallselectK,Ni
unionallselectL,Nw
unionallselectM,N
unionallselectN,N
unionallselectO,Na
unionallselectP,N曝
unionallselectQ,N
unionallselectR,NU
unionallselectS,NR
unionallselectT,NX
unionallselectW,NF
unionallselectX,NR
unionallselectY,N
unionallselectZ,N
)T
whereword>=@wordcollateChinese_PRC_CS_AS_KS_WS
orderbyPYASC
)
else@word
end)
set@str=right(@str,len(@str)-1)
end
return@PY
end
go
IFOBJECT_ID(dbo.fun_getPY)ISNOTNULL
PRINT<<<CREATEDFUNCTIONdbo.fun_getPY>>>
ELSE
PRINT<<<FAILEDCREATINGFUNCTIONdbo.fun_getPY>>>
go
SETANSI_NULLSOFF
go
SETQUOTED_IDENTIFIEROFF
go
挪用
selectdbo.fun_getpy(深蓝)
前往:SL
人们常说“成功孕育成功”,这种说法明显非常适合MySQL的情况。MySQL学习教程这个开源数据库号称在全世界有超过110万份的完全安装。 |
|