mssql sqlserver 中文字转换为全拼的方法分享


摘要:
下文讲述使用sql函数获取汉字拼音的方法分享,如下所示:
实验环境:sql server 2008 R2


最近工作中,需要将汉字的全拼找出来,下文讲述使用sql函数的方法,完成此功能,如下所示:

/*
  创建sql函数,获取汉字怕硬
*/
create function [dbo].[fn_GetPinYin](@tmp nvarchar(88))
returns varchar(8000)
as
begin
 declare @back varchar(8000),@tmpSplit nvarchar(30)
 declare @tmpLength int 
 select @tmpLength =len(@tmp),@back =''
 while @tmpLength >0
 begin  
  set @tmpSplit = substring(@tmp,@tmpLength,1)
      select @back =
        CASE 
        when @tmpSplit <'吖' COLLATE Chinese_PRC_CS_AS_KS_WS then @tmpSplit
        when @tmpSplit <='厑' COLLATE Chinese_PRC_CS_AS_KS_WS then 'A'
        when @tmpSplit <='靉' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ai'
        when @tmpSplit <='黯' COLLATE Chinese_PRC_CS_AS_KS_WS then 'An'
        when @tmpSplit<='醠' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ang'
        when @tmpSplit<='驁' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ao'
        when @tmpSplit<='欛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ba'
        when @tmpSplit<='瓸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bai'
        when @tmpSplit<='瓣' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ban'
        when @tmpSplit<='鎊' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bang'
        when @tmpSplit<='鑤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bao'
        when @tmpSplit<='鐾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bei'
        when @tmpSplit<='輽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ben'
        when @tmpSplit<='鏰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Beng'
        when @tmpSplit<='鼊' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bi'
        when @tmpSplit<='變' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bian'
        when @tmpSplit<='鰾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Biao'
        when @tmpSplit<='彆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bie'
        when @tmpSplit<='鬢' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bin'
        when @tmpSplit<='靐' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bing'
        when @tmpSplit<='蔔' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bo'
        when @tmpSplit<='簿' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bu'
        when @tmpSplit<='囃' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ca'
        when @tmpSplit<='乲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cai'
        when @tmpSplit<='爘' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Can'
        when @tmpSplit<='賶' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cang'
        when @tmpSplit<='鼜' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cao'
        when @tmpSplit<='簎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ce'
        when @tmpSplit<='笒' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cen'
        when @tmpSplit<='乽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ceng'
        when @tmpSplit<='詫' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cha'
        when @tmpSplit<='囆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chai'
        when @tmpSplit<='顫' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chan'
        when @tmpSplit<='韔' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chang'
        when @tmpSplit<='觘' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chao'
        when @tmpSplit<='爡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Che'
        when @tmpSplit<='讖' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chen'
        when @tmpSplit<='秤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cheng'
        when @tmpSplit<='鷘' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chi'
        when @tmpSplit<='銃' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chong'
        when @tmpSplit<='殠' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chou'
        when @tmpSplit<='矗' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chu'
        when @tmpSplit<='踹' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chuai'
        when @tmpSplit<='鶨' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chuan'
        when @tmpSplit<='愴' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chuang'
        when @tmpSplit<='顀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chui'
        when @tmpSplit<='蠢' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chun'
        when @tmpSplit<='縒' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chuo'
        when @tmpSplit<='嗭' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ci'
        when @tmpSplit<='謥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cong'
        when @tmpSplit<='輳' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cou'
        when @tmpSplit<='顣' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cu'
        when @tmpSplit<='爨' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cuan'
        when @tmpSplit<='臎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cui'
        when @tmpSplit<='籿' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cun'
        when @tmpSplit<='錯' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cuo'
        when @tmpSplit<='橽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Da'
        when @tmpSplit<='靆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dai'
        when @tmpSplit<='饏' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dan'
        when @tmpSplit<='闣' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dang'
        when @tmpSplit<='纛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dao'
        when @tmpSplit<='的' COLLATE Chinese_PRC_CS_AS_KS_WS then 'De'
        when @tmpSplit<='扽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Den'
        when @tmpSplit<='鐙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Deng'
        when @tmpSplit<='螮' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Di'
        when @tmpSplit<='嗲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dia'
        when @tmpSplit<='驔' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dian'
        when @tmpSplit<='鑃' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Diao'
        when @tmpSplit<='嚸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Die'
        when @tmpSplit<='顁' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ding'
        when @tmpSplit<='銩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Diu'
        when @tmpSplit<='霘' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dong'
        when @tmpSplit<='鬭' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dou'
        when @tmpSplit<='蠹' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Du'
        when @tmpSplit<='叾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Duan'
        when @tmpSplit<='譵' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dui'
        when @tmpSplit<='踲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dun'
        when @tmpSplit<='鵽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Duo'
        when @tmpSplit<='鱷' COLLATE Chinese_PRC_CS_AS_KS_WS then 'E'
        when @tmpSplit<='摁' COLLATE Chinese_PRC_CS_AS_KS_WS then 'En'
        when @tmpSplit<='鞥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Eng'
        when @tmpSplit<='樲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Er'
        when @tmpSplit<='髮' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fa'
        when @tmpSplit<='瀪' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fan'
        when @tmpSplit<='放' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fang'
        when @tmpSplit<='靅' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fei'
        when @tmpSplit<='鱝' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fen'
        when @tmpSplit<='覅' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Feng'
        when @tmpSplit<='梻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fo'
        when @tmpSplit<='鴀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fou'
        when @tmpSplit<='猤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fu'
        when @tmpSplit<='魀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ga'
        when @tmpSplit<='瓂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gai'
        when @tmpSplit<='灨' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gan'
        when @tmpSplit<='戇' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gang'
        when @tmpSplit<='鋯' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gao'
        when @tmpSplit<='獦' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ge'
        when @tmpSplit<='給' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gei'
        when @tmpSplit<='搄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gen'
        when @tmpSplit<='堩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Geng'
        when @tmpSplit<='兣' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gong'
        when @tmpSplit<='購' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gou'
        when @tmpSplit<='顧' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gu'
        when @tmpSplit<='詿' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gua'
        when @tmpSplit<='恠' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Guai'
        when @tmpSplit<='鱹' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Guan'
        when @tmpSplit<='撗' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Guang'
        when @tmpSplit<='鱥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gui'
        when @tmpSplit<='謴' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gun'
        when @tmpSplit<='腂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Guo'
        when @tmpSplit<='哈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ha'
        when @tmpSplit<='饚' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hai'
        when @tmpSplit<='鶾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Han'
        when @tmpSplit<='沆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hang'
        when @tmpSplit<='兞' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hao'
        when @tmpSplit<='靏' COLLATE Chinese_PRC_CS_AS_KS_WS then 'He'
        when @tmpSplit<='嬒' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hei'
        when @tmpSplit<='恨' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hen'
        when @tmpSplit<='堼' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Heng'
        when @tmpSplit<='鬨' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hong'
        when @tmpSplit<='鱟' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hou'
        when @tmpSplit<='鸌' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hu'
        when @tmpSplit<='蘳' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hua'
        when @tmpSplit<='蘾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Huai'
        when @tmpSplit<='鰀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Huan'
        when @tmpSplit<='鎤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Huang'
        when @tmpSplit<='顪' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hui'
        when @tmpSplit<='諢' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hun'
        when @tmpSplit<='夻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Huo'
        when @tmpSplit<='驥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ji'
        when @tmpSplit<='嗧' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jia'
        when @tmpSplit<='鑳' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jian'
        when @tmpSplit<='謽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jiang'
        when @tmpSplit<='釂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jiao'
        when @tmpSplit<='繲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jie'
        when @tmpSplit<='齽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jin'
        when @tmpSplit<='竸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jing'
        when @tmpSplit<='蘔' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jiong'
        when @tmpSplit<='欍' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jiu'
        when @tmpSplit<='爠' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ju'
        when @tmpSplit<='羂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Juan'
        when @tmpSplit<='钁' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jue'
        when @tmpSplit<='攈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jun'
        when @tmpSplit<='鉲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ka'
        when @tmpSplit<='乫' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kai'
        when @tmpSplit<='矙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kan'
        when @tmpSplit<='閌' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kang'
        when @tmpSplit<='鯌' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kao'
        when @tmpSplit<='騍' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ke'
        when @tmpSplit<='褃' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ken'
        when @tmpSplit<='鏗' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Keng'
        when @tmpSplit<='廤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kong'
        when @tmpSplit<='鷇' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kou'
        when @tmpSplit<='嚳' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ku'
        when @tmpSplit<='骻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kua'
        when @tmpSplit<='鱠' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kuai'
        when @tmpSplit<='窾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kuan'
        when @tmpSplit<='鑛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kuang'
        when @tmpSplit<='鑎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kui'
        when @tmpSplit<='睏' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kun'
        when @tmpSplit<='穒' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kuo'
        when @tmpSplit<='鞡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'La'
        when @tmpSplit<='籟' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lai'
        when @tmpSplit<='糷' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lan'
        when @tmpSplit<='唥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lang'
        when @tmpSplit<='軂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lao'
        when @tmpSplit<='餎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Le'
        when @tmpSplit<='脷' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lei'
        when @tmpSplit<='睖' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Leng'
        when @tmpSplit<='瓈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Li'
        when @tmpSplit<='倆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lia'
        when @tmpSplit<='纞' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lian'
        when @tmpSplit<='鍄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Liang'
        when @tmpSplit<='瞭' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Liao'
        when @tmpSplit<='鱲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lie'
        when @tmpSplit<='轥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lin'
        when @tmpSplit<='炩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ling'
        when @tmpSplit<='咯' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Liu'
        when @tmpSplit<='贚' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Long'
        when @tmpSplit<='鏤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lou'
        when @tmpSplit<='氇' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lu'
        when @tmpSplit<='鑢' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lv'
        when @tmpSplit<='亂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Luan'
        when @tmpSplit<='擽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lue'
        when @tmpSplit<='論' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lun'
        when @tmpSplit<='鱳' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Luo'
        when @tmpSplit<='嘛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ma'
        when @tmpSplit<='霢' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mai'
        when @tmpSplit<='蘰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Man'
        when @tmpSplit<='蠎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mang'
        when @tmpSplit<='唜' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mao'
        when @tmpSplit<='癦' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Me'
        when @tmpSplit<='嚜' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mei'
        when @tmpSplit<='們' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Men'
        when @tmpSplit<='霥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Meng'
        when @tmpSplit<='羃' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mi'
        when @tmpSplit<='麵' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mian'
        when @tmpSplit<='廟' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Miao'
        when @tmpSplit<='鱴' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mie'
        when @tmpSplit<='鰵' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Min'
        when @tmpSplit<='詺' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ming'
        when @tmpSplit<='謬' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Miu'
        when @tmpSplit<='耱' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mo'
        when @tmpSplit<='麰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mou'
        when @tmpSplit<='旀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mu'
        when @tmpSplit<='魶' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Na'
        when @tmpSplit<='錼' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nai'
        when @tmpSplit<='婻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nan'
        when @tmpSplit<='齉' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nang'
        when @tmpSplit<='臑' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nao'
        when @tmpSplit<='呢' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ne'
        when @tmpSplit<='焾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nei'
        when @tmpSplit<='嫩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nen'
        when @tmpSplit<='能' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Neng'
        when @tmpSplit<='嬺' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ni'
        when @tmpSplit<='艌' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nian'
        when @tmpSplit<='釀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Niang'
        when @tmpSplit<='脲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Niao'
        when @tmpSplit<='钀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nie'
        when @tmpSplit<='拰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nin'
        when @tmpSplit<='濘' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ning'
        when @tmpSplit<='靵' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Niu'
        when @tmpSplit<='齈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nong'
        when @tmpSplit<='譳' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nou'
        when @tmpSplit<='搙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nu'
        when @tmpSplit<='衄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nv'
        when @tmpSplit<='瘧' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nue'
        when @tmpSplit<='燶' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nuan'
        when @tmpSplit<='桛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nuo'
        when @tmpSplit<='鞰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'O'
        when @tmpSplit<='漚' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ou'
        when @tmpSplit<='袙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pa'
        when @tmpSplit<='磗' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pai'
        when @tmpSplit<='鑻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pan'
        when @tmpSplit<='胖' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pang'
        when @tmpSplit<='礮' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pao'
        when @tmpSplit<='轡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pei'
        when @tmpSplit<='喯' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pen'
        when @tmpSplit<='喸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Peng'
        when @tmpSplit<='鸊' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pi'
        when @tmpSplit<='騙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pian'
        when @tmpSplit<='慓' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Piao'
        when @tmpSplit<='嫳' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pie'
        when @tmpSplit<='聘' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pin'
        when @tmpSplit<='蘋' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ping'
        when @tmpSplit<='魄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Po'
        when @tmpSplit<='哛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pou'
        when @tmpSplit<='曝' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pu'
        when @tmpSplit<='蟿' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qi'
        when @tmpSplit<='髂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qia'
        when @tmpSplit<='縴' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qian'
        when @tmpSplit<='瓩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qiang'
        when @tmpSplit<='躈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qiao'
        when @tmpSplit<='籡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qie'
        when @tmpSplit<='藽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qin'
        when @tmpSplit<='櫦' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qing'
        when @tmpSplit<='瓗' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qiong'
        when @tmpSplit<='糗' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qiu'
        when @tmpSplit<='覻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qu'
        when @tmpSplit<='勸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Quan'
        when @tmpSplit<='礭' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Que'
        when @tmpSplit<='囕' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qun'
        when @tmpSplit<='橪' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ran'
        when @tmpSplit<='讓' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Rang'
        when @tmpSplit<='繞' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Rao'
        when @tmpSplit<='熱' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Re'
        when @tmpSplit<='餁' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ren'
        when @tmpSplit<='陾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Reng'
        when @tmpSplit<='馹' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ri'
        when @tmpSplit<='穃' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Rong'
        when @tmpSplit<='嶿' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Rou'
        when @tmpSplit<='擩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ru'
        when @tmpSplit<='礝' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ruan'
        when @tmpSplit<='壡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Rui'
        when @tmpSplit<='橍' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Run'
        when @tmpSplit<='鶸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ruo'
        when @tmpSplit<='栍' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sa'
        when @tmpSplit<='虄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sai'
        when @tmpSplit<='閐' COLLATE Chinese_PRC_CS_AS_KS_WS then 'San'
        when @tmpSplit<='喪' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sang'
        when @tmpSplit<='髞' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sao'
        when @tmpSplit<='飋' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Se'
        when @tmpSplit<='篸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sen'
        when @tmpSplit<='縇' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Seng'
        when @tmpSplit<='霎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sha'
        when @tmpSplit<='曬' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shai'
        when @tmpSplit<='鱔' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shan'
        when @tmpSplit<='緔' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shang'
        when @tmpSplit<='潲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shao'
        when @tmpSplit<='欇' COLLATE Chinese_PRC_CS_AS_KS_WS then 'She'
        when @tmpSplit<='瘮' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shen'
        when @tmpSplit<='賸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sheng'
        when @tmpSplit<='瓧' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shi'
        when @tmpSplit<='鏉' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shou'
        when @tmpSplit<='虪' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shu'
        when @tmpSplit<='誜' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shua'
        when @tmpSplit<='卛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shuai'
        when @tmpSplit<='腨' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shuan'
        when @tmpSplit<='灀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shuang'
        when @tmpSplit<='睡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shui'
        when @tmpSplit<='鬊' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shun'
        when @tmpSplit<='鑠' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shuo'
        when @tmpSplit<='乺' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Si'
        when @tmpSplit<='鎹' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Song'
        when @tmpSplit<='瘶' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sou'
        when @tmpSplit<='鷫' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Su'
        when @tmpSplit<='算' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Suan'
        when @tmpSplit<='鐩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sui'
        when @tmpSplit<='潠' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sun'
        when @tmpSplit<='蜶' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Suo'
        when @tmpSplit<='襨' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ta'
        when @tmpSplit<='燤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tai'
        when @tmpSplit<='賧' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tan'
        when @tmpSplit<='燙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tang'
        when @tmpSplit<='畓' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tao'
        when @tmpSplit<='蟘' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Te'
        when @tmpSplit<='朰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Teng'
        when @tmpSplit<='趯' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ti'
        when @tmpSplit<='舚' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tian'
        when @tmpSplit<='糶' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tiao'
        when @tmpSplit<='餮' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tie'
        when @tmpSplit<='乭' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ting'
        when @tmpSplit<='憅' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tong'
        when @tmpSplit<='透' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tou'
        when @tmpSplit<='鵵' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tu'
        when @tmpSplit<='褖' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tuan'
        when @tmpSplit<='駾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tui'
        when @tmpSplit<='坉' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tun'
        when @tmpSplit<='籜' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tuo'
        when @tmpSplit<='韤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wa'
        when @tmpSplit<='顡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wai'
        when @tmpSplit<='贎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wan'
        when @tmpSplit<='朢' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wang'
        when @tmpSplit<='躛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wei'
        when @tmpSplit<='璺' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wen'
        when @tmpSplit<='齆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Weng'
        when @tmpSplit<='齷' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wo'
        when @tmpSplit<='鶩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wu'
        when @tmpSplit<='衋' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xi'
        when @tmpSplit<='鏬' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xia'
        when @tmpSplit<='鼸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xian'
        when @tmpSplit<='鱌' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xiang'
        when @tmpSplit<='斆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xiao'
        when @tmpSplit<='躞' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xie'
        when @tmpSplit<='釁' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xin'
        when @tmpSplit<='臖' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xing'
        when @tmpSplit<='敻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xiong'
        when @tmpSplit<='齅' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xiu'
        when @tmpSplit<='蓿' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xu'
        when @tmpSplit<='贙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xuan'
        when @tmpSplit<='瀥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xue'
        when @tmpSplit<='鑂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xun'
        when @tmpSplit<='齾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ya'
        when @tmpSplit<='灩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yan'
        when @tmpSplit<='樣' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yang'
        when @tmpSplit<='鑰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yao'
        when @tmpSplit<='岃' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ye'
        when @tmpSplit<='齸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yi'
        when @tmpSplit<='檼' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yin'
        when @tmpSplit<='譍' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ying'
        when @tmpSplit<='喲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yo'
        when @tmpSplit<='醟' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yong'
        when @tmpSplit<='鼬' COLLATE Chinese_PRC_CS_AS_KS_WS then 'You'
        when @tmpSplit<='爩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yu'
        when @tmpSplit<='願' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yuan'
        when @tmpSplit<='鸙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yue'
        when @tmpSplit<='韻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yun'
        when @tmpSplit<='雥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Za'
        when @tmpSplit<='縡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zai'
        when @tmpSplit<='饡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zan'
        when @tmpSplit<='臟' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zang'
        when @tmpSplit<='竈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zao'
        when @tmpSplit<='稄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ze'
        when @tmpSplit<='鱡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zei'
        when @tmpSplit<='囎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zen' 
        when @tmpSplit<='贈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zeng'
        when @tmpSplit<='醡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zha'
        when @tmpSplit<='瘵' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhai'
        when @tmpSplit<='驏' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhan'
        when @tmpSplit<='瞕' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhang'
        when @tmpSplit<='羄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhao'
        when @tmpSplit<='鷓' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhe'
        when @tmpSplit<='黮' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhen'
        when @tmpSplit<='證' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zheng'
        when @tmpSplit<='豒' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhi'
        when @tmpSplit<='諥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhong'
        when @tmpSplit<='驟' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhou'
        when @tmpSplit<='鑄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhu'
        when @tmpSplit<='爪' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhua'
        when @tmpSplit<='跩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhuai'
        when @tmpSplit<='籑' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhuan'
        when @tmpSplit<='戅' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhuang'
        when @tmpSplit<='鑆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhui'
        when @tmpSplit<='稕' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhun'
        when @tmpSplit<='籱' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhuo'
        when @tmpSplit<='漬' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zi'
        when @tmpSplit<='縱' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zong'
        when @tmpSplit<='媰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zou'
        when @tmpSplit<='謯' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zu'
        when @tmpSplit<='攥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zuan'
        when @tmpSplit<='欈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zui'
        when @tmpSplit<='銌' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zun'
        when @tmpSplit<='咗' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zuo'
        else  @tmpSplit end+@back,@tmpLength =@tmpLength-1 
   end
 return(@back)
END
GO
SELECT  [dbo].[fn_GetPinYin]('猫猫小屋')
/*
MaoMaoXiaoWu
*/