各位读者,请注意下面的Sql语句中的汉子不是乱码、不是乱码、不是乱码,是每个汉字对应最大的ascii码,因为中文比较大小是按照ascii码进行比对的,根据这个原理写出的如下存储过程,另外不知道汉子组合原理的小伙伴,自行查询规则。如果下面缺失了对应的汉字,请在评论区下方留言,我们一起进步,谢谢!共造和谐技术氛围。
/****** Object: StoredProcedure [dbo].[ConvertChineseToEnglish] ******/ CREATE PROC [dbo].[ConvertChineseToEnglish] @chineseStr VARCHAR(100) , @res VARCHAR(8000) OUTPUT AS BEGIN DECLARE @tmpStr VARCHAR(10); DECLARE @strlen INT; SELECT @strlen = LEN(@chineseStr); SET @res = ''; WHILE @strlen > 0 BEGIN SET @tmpStr = SUBSTRING(@chineseStr, @strlen, 1); SELECT @res = CASE WHEN @tmpStr < '吖' THEN @tmpStr WHEN @tmpStr <= '厑' THEN 'a' WHEN @tmpStr <= '靉' THEN 'ai' WHEN @tmpStr <= '黯' THEN 'an' WHEN @tmpStr <= '醠' THEN 'ang' WHEN @tmpStr <= '驁' THEN 'ao' WHEN @tmpStr <= '欛' THEN 'ba' WHEN @tmpStr <= '瓸' THEN 'bai' WHEN @tmpStr <= '瓣' THEN 'ban' WHEN @tmpStr <= '鎊' THEN 'bang' WHEN @tmpStr <= '鑤' THEN 'bao' WHEN @tmpStr <= '鐾' THEN 'bei' WHEN @tmpStr <= '輽' THEN 'ben' WHEN @tmpStr <= '鏰' THEN 'beng' WHEN @tmpStr <= '鼊' THEN 'bi' WHEN @tmpStr <= '變' THEN 'bian' WHEN @tmpStr <= '鰾' THEN 'biao' WHEN @tmpStr <= '彆' THEN 'bie' WHEN @tmpStr <= '鬢' THEN 'bin' WHEN @tmpStr <= '靐' THEN 'bing' WHEN @tmpStr <= '蔔' THEN 'bo' WHEN @tmpStr <= '簿' THEN 'bu' WHEN @tmpStr <= '囃' THEN 'ca' WHEN @tmpStr <= '乲' THEN 'cai' WHEN @tmpStr <= '爘' THEN 'can' WHEN @tmpStr <= '賶' THEN 'cang' WHEN @tmpStr <= '鼜' THEN 'cao' WHEN @tmpStr <= '簎' THEN 'ce' WHEN @tmpStr <= '笒' THEN 'cen' WHEN @tmpStr <= '乽' THEN 'ceng' WHEN @tmpStr <= '詫' THEN 'cha' WHEN @tmpStr <= '囆' THEN 'chai' WHEN @tmpStr <= '顫' THEN 'chan' WHEN @tmpStr <= '韔' THEN 'chang' WHEN @tmpStr <= '觘' THEN 'chao' WHEN @tmpStr <= '爡' THEN 'che' WHEN @tmpStr <= '讖' THEN 'chen' WHEN @tmpStr <= '秤' THEN 'cheng' WHEN @tmpStr <= '鷘' THEN 'chi' WHEN @tmpStr <= '銃' THEN 'chong' WHEN @tmpStr <= '殠' THEN 'chou' WHEN @tmpStr <= '矗' THEN 'chu' WHEN @tmpStr <= '踹' THEN 'chuai' WHEN @tmpStr <= '鶨' THEN 'chuan' WHEN @tmpStr <= '愴' THEN 'chuang' WHEN @tmpStr <= '顀' THEN 'chui' WHEN @tmpStr <= '蠢' THEN 'chun' WHEN @tmpStr <= '縒' THEN 'chuo' WHEN @tmpStr <= '嗭' THEN 'ci' WHEN @tmpStr <= '謥' THEN 'cong' WHEN @tmpStr <= '輳' THEN 'cou' WHEN @tmpStr <= '顣' THEN 'cu' WHEN @tmpStr <= '爨' THEN 'cuan' WHEN @tmpStr <= '臎' THEN 'cui' WHEN @tmpStr <= '籿' THEN 'cun' WHEN @tmpStr <= '錯' THEN 'cuo' WHEN @tmpStr <= '橽' THEN 'da' WHEN @tmpStr <= '靆' THEN 'dai' WHEN @tmpStr <= '饏' THEN 'dan' WHEN @tmpStr <= '闣' THEN 'dang' WHEN @tmpStr <= '纛' THEN 'dao' WHEN @tmpStr <= '的' THEN 'de' WHEN @tmpStr <= '扽' THEN 'den' WHEN @tmpStr <= '鐙' THEN 'deng' WHEN @tmpStr <= '螮' THEN 'di' WHEN @tmpStr <= '嗲' THEN 'dia' WHEN @tmpStr <= '驔' THEN 'dian' WHEN @tmpStr <= '鑃' THEN 'diao' WHEN @tmpStr <= '嚸' THEN 'die' WHEN @tmpStr <= '顁' THEN 'ding' WHEN @tmpStr <= '銩' THEN 'diu' WHEN @tmpStr <= '霘' THEN 'dong' WHEN @tmpStr <= '鬭' THEN 'dou' WHEN @tmpStr <= '蠹' THEN 'du' WHEN @tmpStr <= '叾' THEN 'duan' WHEN @tmpStr <= '譵' THEN 'dui' WHEN @tmpStr <= '踲' THEN 'dun' WHEN @tmpStr <= '鵽' THEN 'duo' WHEN @tmpStr <= '鱷' THEN 'e' WHEN @tmpStr <= '摁' THEN 'en' WHEN @tmpStr <= '鞥' THEN 'eng' WHEN @tmpStr <= '樲' THEN 'er' WHEN @tmpStr <= '髮' THEN 'fa' WHEN @tmpStr <= '瀪' THEN 'fan' WHEN @tmpStr <= '放' THEN 'fang' WHEN @tmpStr <= '靅' THEN 'fei' WHEN @tmpStr <= '鱝' THEN 'fen' WHEN @tmpStr <= '覅' THEN 'feng' WHEN @tmpStr <= '梻' THEN 'fo' WHEN @tmpStr <= '鴀' THEN 'fou' WHEN @tmpStr <= '猤' THEN 'fu' WHEN @tmpStr <= '魀' THEN 'ga' WHEN @tmpStr <= '瓂' THEN 'gai' WHEN @tmpStr <= '灨' THEN 'gan' WHEN @tmpStr <= '戇' THEN 'gang' WHEN @tmpStr <= '鋯' THEN 'gao' WHEN @tmpStr <= '獦' THEN 'ge' WHEN @tmpStr <= '給' THEN 'gei' WHEN @tmpStr <= '搄' THEN 'gen' WHEN @tmpStr <= '堩' THEN 'geng' WHEN @tmpStr <= '兣' THEN 'gong' WHEN @tmpStr <= '購' THEN 'gou' WHEN @tmpStr <= '顧' THEN 'gu' WHEN @tmpStr <= '詿' THEN 'gua' WHEN @tmpStr <= '恠' THEN 'guai' WHEN @tmpStr <= '鱹' THEN 'guan' WHEN @tmpStr <= '撗' THEN 'guang' WHEN @tmpStr <= '鱥' THEN 'gui' WHEN @tmpStr <= '謴' THEN 'gun' WHEN @tmpStr <= '腂' THEN 'guo' WHEN @tmpStr <= '哈' THEN 'ha' WHEN @tmpStr <= '饚' THEN 'hai' WHEN @tmpStr <= '鶾' THEN 'han' WHEN @tmpStr <= '沆' THEN 'hang' WHEN @tmpStr <= '兞' THEN 'hao' WHEN @tmpStr <= '靏' THEN 'he' WHEN @tmpStr <= '嬒' THEN 'hei' WHEN @tmpStr <= '恨' THEN 'hen' WHEN @tmpStr <= '堼' THEN 'heng' WHEN @tmpStr <= '鬨' THEN 'hong' WHEN @tmpStr <= '鱟' THEN 'hou' WHEN @tmpStr <= '鸌' THEN 'hu' WHEN @tmpStr <= '蘳' THEN 'hua' WHEN @tmpStr <= '蘾' THEN 'huai' WHEN @tmpStr <= '鰀' THEN 'huan' WHEN @tmpStr <= '鎤' THEN 'huang' WHEN @tmpStr <= '顪' THEN 'hui' WHEN @tmpStr <= '諢' THEN 'hun' WHEN @tmpStr <= '夻' THEN 'huo' WHEN @tmpStr <= '驥' THEN 'ji' WHEN @tmpStr <= '嗧' THEN 'jia' WHEN @tmpStr <= '鑳' THEN 'jian' WHEN @tmpStr <= '謽' THEN 'jiang' WHEN @tmpStr <= '釂' THEN 'jiao' WHEN @tmpStr <= '繲' THEN 'jie' WHEN @tmpStr <= '齽' THEN 'jin' WHEN @tmpStr <= '竸' THEN 'jing' WHEN @tmpStr <= '蘔' THEN 'jiong' WHEN @tmpStr <= '欍' THEN 'jiu' WHEN @tmpStr <= '爠' THEN 'ju' WHEN @tmpStr <= '羂' THEN 'juan' WHEN @tmpStr <= '钁' THEN 'jue' WHEN @tmpStr <= '攈' THEN 'jun' WHEN @tmpStr <= '鉲' THEN 'ka' WHEN @tmpStr <= '乫' THEN 'kai' WHEN @tmpStr <= '矙' THEN 'kan' WHEN @tmpStr <= '閌' THEN 'kang' WHEN @tmpStr <= '鯌' THEN 'kao' WHEN @tmpStr <= '騍' THEN 'ke' WHEN @tmpStr <= '褃' THEN 'ken' WHEN @tmpStr <= '鏗' THEN 'keng' WHEN @tmpStr <= '廤' THEN 'kong' WHEN @tmpStr <= '鷇' THEN 'kou' WHEN @tmpStr <= '嚳' THEN 'ku' WHEN @tmpStr <= '骻' THEN 'kua' WHEN @tmpStr <= '鱠' THEN 'kuai' WHEN @tmpStr <= '窾' THEN 'kuan' WHEN @tmpStr <= '鑛' THEN 'kuang' WHEN @tmpStr <= '鑎' THEN 'kui' WHEN @tmpStr <= '睏' THEN 'kun' WHEN @tmpStr <= '穒' THEN 'kuo' WHEN @tmpStr <= '鞡' THEN 'la' WHEN @tmpStr <= '籟' THEN 'lai' WHEN @tmpStr <= '糷' THEN 'lan' WHEN @tmpStr <= '唥' THEN 'lang' WHEN @tmpStr <= '軂' THEN 'lao' WHEN @tmpStr <= '餎' THEN 'le' WHEN @tmpStr <= '脷' THEN 'lei' WHEN @tmpStr <= '睖' THEN 'leng' WHEN @tmpStr <= '瓈' THEN 'li' WHEN @tmpStr <= '倆' THEN 'lia' WHEN @tmpStr <= '纞' THEN 'lian' WHEN @tmpStr <= '鍄' THEN 'liang' WHEN @tmpStr <= '瞭' THEN 'liao' WHEN @tmpStr <= '鱲' THEN 'lie' WHEN @tmpStr <= '轥' THEN 'lin' WHEN @tmpStr <= '炩' THEN 'ling' WHEN @tmpStr <= '咯' THEN 'liu' WHEN @tmpStr <= '贚' THEN 'long' WHEN @tmpStr <= '鏤' THEN 'lou' WHEN @tmpStr <= '氇' THEN 'lu' WHEN @tmpStr <= '鑢' THEN 'lv' WHEN @tmpStr <= '亂' THEN 'luan' WHEN @tmpStr <= '擽' THEN 'lue' WHEN @tmpStr <= '論' THEN 'lun' WHEN @tmpStr <= '鱳' THEN 'luo' WHEN @tmpStr <= '嘛' THEN 'ma' WHEN @tmpStr <= '霢' THEN 'mai' WHEN @tmpStr <= '蘰' THEN 'man' WHEN @tmpStr <= '蠎' THEN 'mang' WHEN @tmpStr <= '唜' THEN 'mao' WHEN @tmpStr <= '癦' THEN 'me' WHEN @tmpStr <= '嚜' THEN 'mei' WHEN @tmpStr <= '們' THEN 'men' WHEN @tmpStr <= '霥' THEN 'meng' WHEN @tmpStr <= '羃' THEN 'mi' WHEN @tmpStr <= '麵' THEN 'mian' WHEN @tmpStr <= '廟' THEN 'miao' WHEN @tmpStr <= '鱴' THEN 'mie' WHEN @tmpStr <= '鰵' THEN 'min' WHEN @tmpStr <= '詺' THEN 'ming' WHEN @tmpStr <= '謬' THEN 'miu' WHEN @tmpStr <= '耱' THEN 'mo' WHEN @tmpStr <= '麰' THEN 'mou' WHEN @tmpStr <= '旀' THEN 'mu' WHEN @tmpStr <= '魶' THEN 'na' WHEN @tmpStr <= '錼' THEN 'nai' WHEN @tmpStr <= '婻' THEN 'nan' WHEN @tmpStr <= '齉' THEN 'nang' WHEN @tmpStr <= '臑' THEN 'nao' WHEN @tmpStr <= '呢' THEN 'ne' WHEN @tmpStr <= '焾' THEN 'nei' WHEN @tmpStr <= '嫩' THEN 'nen' WHEN @tmpStr <= '能' THEN 'neng' WHEN @tmpStr <= '嬺' THEN 'ni' WHEN @tmpStr <= '艌' THEN 'nian' WHEN @tmpStr <= '釀' THEN 'niang' WHEN @tmpStr <= '脲' THEN 'niao' WHEN @tmpStr <= '钀' THEN 'nie' WHEN @tmpStr <= '拰' THEN 'nin' WHEN @tmpStr <= '濘' THEN 'ning' WHEN @tmpStr <= '靵' THEN 'niu' WHEN @tmpStr <= '齈' THEN 'nong' WHEN @tmpStr <= '譳' THEN 'nou' WHEN @tmpStr <= '搙' THEN 'nu' WHEN @tmpStr <= '衄' THEN 'nv' WHEN @tmpStr <= '瘧' THEN 'nue' WHEN @tmpStr <= '燶' THEN 'nuan' WHEN @tmpStr <= '桛' THEN 'nuo' WHEN @tmpStr <= '鞰' THEN 'o' WHEN @tmpStr <= '漚' THEN 'ou' WHEN @tmpStr <= '袙' THEN 'pa' WHEN @tmpStr <= '磗' THEN 'pai' WHEN @tmpStr <= '鑻' THEN 'pan' WHEN @tmpStr <= '胖' THEN 'pang' WHEN @tmpStr <= '礮' THEN 'pao' WHEN @tmpStr <= '轡' THEN 'pei' WHEN @tmpStr <= '喯' THEN 'pen' WHEN @tmpStr <= '喸' THEN 'peng' WHEN @tmpStr <= '鸊' THEN 'pi' WHEN @tmpStr <= '騙' THEN 'pian' WHEN @tmpStr <= '慓' THEN 'piao' WHEN @tmpStr <= '嫳' THEN 'pie' WHEN @tmpStr <= '聘' THEN 'pin' WHEN @tmpStr <= '蘋' THEN 'ping' WHEN @tmpStr <= '魄' THEN 'po' WHEN @tmpStr <= '哛' THEN 'pou' WHEN @tmpStr <= '曝' THEN 'pu' WHEN @tmpStr <= '蟿' THEN 'qi' WHEN @tmpStr <= '髂' THEN 'qia' WHEN @tmpStr <= '縴' THEN 'qian' WHEN @tmpStr <= '瓩' THEN 'qiang' WHEN @tmpStr <= '躈' THEN 'qiao' WHEN @tmpStr <= '籡' THEN 'qie' WHEN @tmpStr <= '藽' THEN 'qin' WHEN @tmpStr <= '櫦' THEN 'qing' WHEN @tmpStr <= '瓗' THEN 'qiong' WHEN @tmpStr <= '糗' THEN 'qiu' WHEN @tmpStr <= '覻' THEN 'qu' WHEN @tmpStr <= '勸' THEN 'quan' WHEN @tmpStr <= '礭' THEN 'que' WHEN @tmpStr <= '囕' THEN 'qun' WHEN @tmpStr <= '橪' THEN 'ran' WHEN @tmpStr <= '讓' THEN 'rang' WHEN @tmpStr <= '繞' THEN 'rao' WHEN @tmpStr <= '熱' THEN 're' WHEN @tmpStr <= '餁' THEN 'ren' WHEN @tmpStr <= '陾' THEN 'reng' WHEN @tmpStr <= '馹' THEN 'ri' WHEN @tmpStr <= '穃' THEN 'rong' WHEN @tmpStr <= '嶿' THEN 'rou' WHEN @tmpStr <= '擩' THEN 'ru' WHEN @tmpStr <= '礝' THEN 'ruan' WHEN @tmpStr <= '壡' THEN 'rui' WHEN @tmpStr <= '橍' THEN 'run' WHEN @tmpStr <= '鶸' THEN 'ruo' WHEN @tmpStr <= '栍' THEN 'sa' WHEN @tmpStr <= '虄' THEN 'sai' WHEN @tmpStr <= '閐' THEN 'san' WHEN @tmpStr <= '喪' THEN 'sang' WHEN @tmpStr <= '髞' THEN 'sao' WHEN @tmpStr <= '飋' THEN 'se' WHEN @tmpStr <= '篸' THEN 'sen' WHEN @tmpStr <= '縇' THEN 'seng' WHEN @tmpStr <= '霎' THEN 'sha' WHEN @tmpStr <= '曬' THEN 'shai' WHEN @tmpStr <= '鱔' THEN 'shan' WHEN @tmpStr <= '緔' THEN 'shang' WHEN @tmpStr <= '潲' THEN 'shao' WHEN @tmpStr <= '欇' THEN 'she' WHEN @tmpStr <= '瘮' THEN 'shen' WHEN @tmpStr <= '賸' THEN 'sheng' WHEN @tmpStr <= '瓧' THEN 'shi' WHEN @tmpStr <= '鏉' THEN 'shou' WHEN @tmpStr <= '虪' THEN 'shu' WHEN @tmpStr <= '誜' THEN 'shua' WHEN @tmpStr <= '卛' THEN 'shuai' WHEN @tmpStr <= '腨' THEN 'shuan' WHEN @tmpStr <= '灀' THEN 'shuang' WHEN @tmpStr <= '睡' THEN 'shui' WHEN @tmpStr <= '鬊' THEN 'shun' WHEN @tmpStr <= '鑠' THEN 'shuo' WHEN @tmpStr <= '乺' THEN 'si' WHEN @tmpStr <= '鎹' THEN 'song' WHEN @tmpStr <= '瘶' THEN 'sou' WHEN @tmpStr <= '鷫' THEN 'su' WHEN @tmpStr <= '算' THEN 'suan' WHEN @tmpStr <= '鐩' THEN 'sui' WHEN @tmpStr <= '潠' THEN 'sun' WHEN @tmpStr <= '蜶' THEN 'suo' WHEN @tmpStr <= '襨' THEN 'ta' WHEN @tmpStr <= '燤' THEN 'tai' WHEN @tmpStr <= '賧' THEN 'tan' WHEN @tmpStr <= '燙' THEN 'tang' WHEN @tmpStr <= '畓' THEN 'tao' WHEN @tmpStr <= '蟘' THEN 'te' WHEN @tmpStr <= '朰' THEN 'teng' WHEN @tmpStr <= '趯' THEN 'ti' WHEN @tmpStr <= '舚' THEN 'tian' WHEN @tmpStr <= '糶' THEN 'tiao' WHEN @tmpStr <= '餮' THEN 'tie' WHEN @tmpStr <= '乭' THEN 'ting' WHEN @tmpStr <= '憅' THEN 'tong' WHEN @tmpStr <= '透' THEN 'tou' WHEN @tmpStr <= '鵵' THEN 'tu' WHEN @tmpStr <= '褖' THEN 'tuan' WHEN @tmpStr <= '駾' THEN 'tui' WHEN @tmpStr <= '坉' THEN 'tun' WHEN @tmpStr <= '籜' THEN 'tuo' WHEN @tmpStr <= '韤' THEN 'wa' WHEN @tmpStr <= '顡' THEN 'wai' WHEN @tmpStr <= '贎' THEN 'wan' WHEN @tmpStr <= '朢' THEN 'wang' WHEN @tmpStr <= '躛' THEN 'wei' WHEN @tmpStr <= '璺' THEN 'wen' WHEN @tmpStr <= '齆' THEN 'weng' WHEN @tmpStr <= '齷' THEN 'wo' WHEN @tmpStr <= '鶩' THEN 'wu' WHEN @tmpStr <= '衋' THEN 'xi' WHEN @tmpStr <= '鏬' THEN 'xia' WHEN @tmpStr <= '鼸' THEN 'xian' WHEN @tmpStr <= '鱌' THEN 'xiang' WHEN @tmpStr <= '斆' THEN 'xiao' WHEN @tmpStr <= '躞' THEN 'xie' WHEN @tmpStr <= '釁' THEN 'xin' WHEN @tmpStr <= '臖' THEN 'xing' WHEN @tmpStr <= '敻' THEN 'xiong' WHEN @tmpStr <= '齅' THEN 'xiu' WHEN @tmpStr <= '蓿' THEN 'xu' WHEN @tmpStr <= '贙' THEN 'xuan' WHEN @tmpStr <= '瀥' THEN 'xue' WHEN @tmpStr <= '鑂' THEN 'xun' WHEN @tmpStr <= '齾' THEN 'ya' WHEN @tmpStr <= '灩' THEN 'yan' WHEN @tmpStr <= '樣' THEN 'yang' WHEN @tmpStr <= '鑰' THEN 'yao' WHEN @tmpStr <= '岃' THEN 'ye' WHEN @tmpStr <= '齸' THEN 'yi' WHEN @tmpStr <= '檼' THEN 'yin' WHEN @tmpStr <= '譍' THEN 'ying' WHEN @tmpStr <= '喲' THEN 'yo' WHEN @tmpStr <= '醟' THEN 'yong' WHEN @tmpStr <= '鼬' THEN 'you' WHEN @tmpStr <= '爩' THEN 'yu' WHEN @tmpStr <= '願' THEN 'yuan' WHEN @tmpStr <= '鸙' THEN 'yue' WHEN @tmpStr <= '韻' THEN 'yun' WHEN @tmpStr <= '雥' THEN 'za' WHEN @tmpStr <= '縡' THEN 'zai' WHEN @tmpStr <= '饡' THEN 'zan' WHEN @tmpStr <= '臟' THEN 'zang' WHEN @tmpStr <= '竈' THEN 'zao' WHEN @tmpStr <= '稄' THEN 'ze' WHEN @tmpStr <= '鱡' THEN 'zei' WHEN @tmpStr <= '囎' THEN 'zen' WHEN @tmpStr <= '贈' THEN 'zeng' WHEN @tmpStr <= '醡' THEN 'zha' WHEN @tmpStr <= '瘵' THEN 'zhai' WHEN @tmpStr <= '驏' THEN 'zhan' WHEN @tmpStr <= '瞕' THEN 'zhang' WHEN @tmpStr <= '羄' THEN 'zhao' WHEN @tmpStr <= '鷓' THEN 'zhe' WHEN @tmpStr <= '黮' THEN 'zhen' WHEN @tmpStr <= '證' THEN 'zheng' WHEN @tmpStr <= '豒' THEN 'zhi' WHEN @tmpStr <= '諥' THEN 'zhong' WHEN @tmpStr <= '驟' THEN 'zhou' WHEN @tmpStr <= '鑄' THEN 'zhu' WHEN @tmpStr <= '爪' THEN 'zhua' WHEN @tmpStr <= '跩' THEN 'zhuai' WHEN @tmpStr <= '籑' THEN 'zhuan' WHEN @tmpStr <= '戅' THEN 'zhuang' WHEN @tmpStr <= '鑆' THEN 'zhui' WHEN @tmpStr <= '稕' THEN 'zhun' WHEN @tmpStr <= '籱' THEN 'zhuo' WHEN @tmpStr <= '漬' THEN 'zi' WHEN @tmpStr <= '縱' THEN 'zong' WHEN @tmpStr <= '媰' THEN 'zou' WHEN @tmpStr <= '謯' THEN 'zu' WHEN @tmpStr <= '攥' THEN 'zuan' WHEN @tmpStr <= '欈' THEN 'zui' WHEN @tmpStr <= '銌' THEN 'zun' WHEN @tmpStr <= '咗' THEN 'zuo' ELSE @tmpStr END + @res , @strlen = @strlen - 1; END; END; GO