加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

[MSSQL]汉字转全拼音函数优化方案(SQLServer),值得你看看

发布时间:2020-12-12 14:47:23 所属栏目:MsSql教程 来源:网络整理
导读:转自:http://www.cnblogs.com/zhuisuo/archive/2012/01/11/2318908.html create function [dbo].[fn_Getquanpin3](@str varchar(100))returns varchar(8000)asbegin declare @re varchar(8000),@crs varchar(10) declare @strlen int select @strlen=len(@s

转自:http://www.cnblogs.com/zhuisuo/archive/2012/01/11/2318908.html

create function [dbo].[fn_Getquanpin3](@str varchar(100))
returns varchar(8000)
as
begin
 declare @re varchar(8000),@crs varchar(10)
 declare @strlen int 
 select @strlen=len(@str),@re=''
 while @strlen>0
 begin  
  set @crs= substring(@str,@strlen,1)
      select @re=
        case
        when @crs<'吖' then @crs
        when @crs<='厑' then 'a'
        when @crs<='靉' then 'ai'
        when @crs<='黯' then 'an'
        when @crs<='醠' then 'ang'
        when @crs<='驁' then 'ao'
        when @crs<='欛' then 'ba'
        when @crs<='瓸' then 'bai'
        when @crs<='瓣' then 'ban'
        when @crs<='鎊' then 'bang'
        when @crs<='鑤' then 'bao'
        when @crs<='鐾' then 'bei'
        when @crs<='輽' then 'ben'
        when @crs<='鏰' then 'beng'
        when @crs<='鼊' then 'bi'
        when @crs<='變' then 'bian'
        when @crs<='鰾' then 'biao'
        when @crs<='彆' then 'bie'
        when @crs<='鬢' then 'bin'
        when @crs<='靐' then 'bing'
        when @crs<='蔔' then 'bo'
        when @crs<='簿' then 'bu'
        when @crs<='囃' then 'ca'
        when @crs<='乲' then 'cai'
        when @crs<='爘' then 'can'
        when @crs<='賶' then 'cang'
        when @crs<='鼜' then 'cao'
        when @crs<='簎' then 'ce'
        when @crs<='笒' then 'cen'
        when @crs<='乽' then 'ceng'
        when @crs<='詫' then 'cha'
        when @crs<='囆' then 'chai'
        when @crs<='顫' then 'chan'
        when @crs<='韔' then 'chang'
        when @crs<='觘' then 'chao'
        when @crs<='爡' then 'che'
        when @crs<='讖' then 'chen'
        when @crs<='秤' then 'cheng'
        when @crs<='鷘' then 'chi'
        when @crs<='銃' then 'chong'
        when @crs<='殠' then 'chou'
        when @crs<='矗' then 'chu'
        when @crs<='踹' then 'chuai'
        when @crs<='鶨' then 'chuan'
        when @crs<='愴' then 'chuang'
        when @crs<='顀' then 'chui'
        when @crs<='蠢' then 'chun'
        when @crs<='縒' then 'chuo'
        when @crs<='嗭' then 'ci'
        when @crs<='謥' then 'cong'
        when @crs<='輳' then 'cou'
        when @crs<='顣' then 'cu'
        when @crs<='爨' then 'cuan'
        when @crs<='臎' then 'cui'
        when @crs<='籿' then 'cun'
        when @crs<='錯' then 'cuo'
        when @crs<='                        

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读