日期:2014-05-18  浏览次数:20527 次

从获取拼音函数得到的一点体会,不对的地方欢迎指正
SQL code

/*---------------------------------
--  Author : htl258(Tony)
--  Date   : 2009-09-18 19:03:53
--  Version: Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (Intel X86) 
    Mar 29 2009 10:27:29 
    Copyright (c) 1988-2008 Microsoft Corporation
    Enterprise Evaluation Edition on Windows NT 5.1 <X86> (Build 2600: Service Pack 2)

---------------------------------*/

--1.创建表[t_GetPinyin],建在函数外,目的为了提高查询效率
IF OBJECT_ID('[t_GetPinyin]') IS NOT NULL
    DROP TABLE [t_GetPinyin] 
GO
CREATE TABLE [t_GetPinyin]([py] NVARCHAR(20),[word] NVARCHAR(10) COLLATE Chinese_PRC_CS_AS_KS_WS)
INSERT [t_GetPinyin] 
SELECT 'a' ,N'厑' UNION ALL
SELECT 'ai',N'靉' UNION ALL 
SELECT 'an',N'黯' UNION ALL 
SELECT 'ang',N'醠' UNION ALL 
SELECT 'ao',N'驁' UNION ALL 
SELECT 'ba',N'欛' UNION ALL 
SELECT 'bai',N'瓸' UNION ALL --韛兡瓸
SELECT 'ban',N'瓣' UNION ALL 
SELECT 'bang',N'鎊' UNION ALL 
SELECT 'bao',N'鑤' UNION ALL 
SELECT 'bei',N'鐾' UNION ALL 
SELECT 'ben',N'輽' UNION ALL 
SELECT 'beng',N'鏰' UNION ALL 
SELECT 'bi',N'鼊' UNION ALL 
SELECT 'bian',N'變' UNION ALL 
SELECT 'biao',N'鰾' UNION ALL 
SELECT 'bie',N'彆' UNION ALL 
SELECT 'bin',N'鬢' UNION ALL 
SELECT 'bing',N'靐' UNION ALL 
SELECT 'bo',N'蔔' UNION ALL 
SELECT 'bu',N'簿' UNION ALL 
SELECT 'ca',N'囃' UNION ALL 
SELECT 'cai',N'乲' UNION ALL --縩乲 
SELECT 'can',N'爘' UNION ALL 
SELECT 'cang',N'賶' UNION ALL 
SELECT 'cao',N'鼜' UNION ALL 
SELECT 'ce',N'簎' UNION ALL 
SELECT 'cen',N'笒' UNION ALL 
SELECT 'ceng',N'乽' UNION ALL  --硛硳岾猠乽
SELECT 'cha',N'詫' UNION ALL 
SELECT 'chai',N'囆' UNION ALL 
SELECT 'chan',N'顫' UNION ALL 
SELECT 'chang',N'韔' UNION ALL 
SELECT 'chao',N'觘' UNION ALL 
SELECT 'che',N'爡' UNION ALL 
SELECT 'chen',N'讖' UNION ALL 
SELECT 'cheng',N'秤' UNION ALL 
SELECT 'chi',N'鷘' UNION ALL 
SELECT 'chong',N'銃' UNION ALL 
SELECT 'chou',N'殠' UNION ALL 
SELECT 'chu',N'矗' UNION ALL 
SELECT 'chuai',N'踹' UNION ALL 
SELECT 'chuan',N'鶨' UNION ALL 
SELECT 'chuang',N'愴' UNION ALL 
SELECT 'chui',N'顀' UNION ALL 
SELECT 'chun',N'蠢' UNION ALL 
SELECT 'chuo',N'縒' UNION ALL 
SELECT 'ci',N'嗭'  UNION ALL --賜嗭
SELECT 'cong',N'謥' UNION ALL 
SELECT 'cou',N'輳' UNION ALL 
SELECT 'cu',N'顣' UNION ALL 
SELECT 'cuan',N'爨' UNION ALL 
SELECT 'cui',N'臎' UNION ALL 
SELECT 'cun',N'籿' UNION ALL 
SELECT 'cuo',N'錯' UNION ALL 
SELECT 'da',N'橽' UNION ALL 
SELECT 'dai',N'靆' UNION ALL 
SELECT 'dan',N'饏' UNION ALL 
SELECT 'dang',N'闣' UNION ALL 
SELECT 'dao',N'纛' UNION ALL 
SELECT 'de',N'的' UNION ALL 
SELECT 'den',N'扽' UNION ALL 
SELECT 'deng',N'鐙' UNION ALL 
SELECT 'di',N'螮' UNION ALL 
SELECT 'dia',N'嗲' UNION ALL 
SELECT 'dian',N'驔' UNION ALL 
SELECT 'diao',N'鑃' UNION ALL 
SELECT 'die',N'嚸' UNION ALL  --眰嚸
SELECT 'ding',N'顁' UNION ALL 
SELECT 'diu',N'銩' UNION ALL 
SELECT 'dong',N'霘' UNION ALL 
SELECT 'dou',N'鬭' UNION ALL 
SELECT 'du',N'蠹' UNION ALL 
SELECT 'duan',N'叾' UNION ALL  --籪叾
SELECT 'dui',N'譵' UNION ALL 
SELECT 'dun',N'踲' UNION ALL 
SELECT 'duo',N'鵽' UNION ALL 
SELECT 'e',N'鱷' UNION ALL 
SELECT 'en',N'摁' UNION ALL 
SELECT 'eng',N'鞥' UNION ALL 
SELECT 'er',N'樲' UNION ALL 
SELECT 'fa',N'髮' UNION ALL 
SELECT 'fan',N'瀪' UNION ALL 
SELECT 'fang',N'放' UNION ALL 
SELECT 'fei',N'靅' UNION ALL 
SELECT 'fen',N'鱝' UNION ALL 
SELECT 'feng',N'覅' UNION ALL 
SELECT 'fo',N'梻' UNION ALL 
SELECT 'fou',N'鴀' UNION ALL 
SELECT 'fu',N'猤' UNION ALL  --鰒猤
SELECT 'ga',N'魀' UNION ALL 
SELECT 'gai',N'瓂' UNION ALL 
SELECT 'gan',N'灨' UNION ALL 
SELECT 'gang',N'戇' UNION ALL 
SELECT 'gao',N'鋯' UNION ALL 
SELECT 'ge',N'獦' UNION ALL 
SELECT 'gei',N'給' UNION ALL 
SELECT 'gen',N'搄' UNION ALL 
SELECT 'geng',N'堩' UNION ALL  --亙堩啹喼嗰
SELECT 'gong',N'兣' UNION ALL  --熕贑兝兣
SELECT 'gou',N'購' UNION ALL 
SELECT 'gu',N'顧' UNION ALL 
SELECT 'gua',N'詿' UNION ALL 
SELECT 'guai',N'恠' UNION ALL 
SELECT 'guan',N'鱹' UNION ALL 
SELECT 'guang',N'撗' UNION ALL 
SELECT 'gui',N'鱥' UNION ALL 
SELECT 'gun',N'謴' UNION ALL 
SELECT 'guo',N'腂' UNI