以下的文章主要向大家讲述的是如何正确获取汉字字串的拼音声母在SQL Server数据库中,此文主要是通过其实际操作代码来引出其正确的操作步骤,以下就是实现其具体操作的内容的描述,希望在你今后的学习中会有所帮助。

    CREATEfunctionfGetPy(@strvarchar(500)='') returnsvarchar(500) as begin declare@strlenint,@returnvarchar(500),@iiint declare@cnchar(1),@chnnchar(1) CREATEfunctionfGetPy(@strvarchar(500)='') returnsvarchar(500) as begin declare@strlenint,@returnvarchar(500),@iiint declare@cnchar(1),@chnnchar(1) select@strlen=len(@str),@return='',@ii=0set@ii=0while@ii<@strlen begin select@ii=@ii+1,@chn=substring(@str,@ii,1) if@chn>='吖' select@c=char(count(*)+63)from( selecttop27*from( selectchn='吖'unionallselect'八' unionallselect'嚓' unionallselect'咑' unionallselect'妸' unionallselect'发' unionallselect'旮' unionallselect'铪' unionallselect'丌'--becausehaveno'i' unionallselect'丌' unionallselect'咔' unionallselect'垃' unionallselect'嘸' unionallselect'拏' unionallselect'噢' unionallselect'妑' unionallselect'七' unionallselect'呥' unionallselect'仨' unionallselect'他' unionallselect'屲'--no'u' unionallselect'屲'--no'v' unionallselect'屲' unionallselect'夕' unionallselect'丫' unionallselect'帀' unionallselect@chn )asa orderbychnCOLLATEChinese_PRC_CI_AS)asb whereb.chn<=@chn elseset@c=@chn set@return=@return+@c end return(@return) end

以上的相关内容就是对SQL Server数据库的介绍,望你能有所收获。

【编辑推荐】

    SQL Server数据修复命令DBCC的使用SQL Server数据整理的操作方案描述SQL Server 易混淆的一些数据类型有哪些?SQL Server 日期操作全接触,嘻嘻对SQL Server 2005 BI的描述