实现首字母或拼音检索-sql语句方式
create function [dbo].[fn_GetPY](@str nvarchar(max),@type int)
returns nvarchar(max)
as
begin if(@type=1)
begin
DECLARE @WORD NCHAR(1),@PY NVARCHAR(4000)
SET @PY=''
WHILE LEN(@STR)>0
BEGIN
SET @WORD=LEFT(@STR,1)
--如果非漢字字符﹐返回原字符
SET @PY=@PY+(CASE WHEN UNICODE(@WORD) BETWEEN 19968 AND 19968+20901
THEN (
SELECT TOP 1 PY
FROM
(
SELECT 'A' AS PY,N'驁' AS WORD
UNION ALL SELECT 'B',N'簿'
UNION ALL SELECT 'C',N'錯'
UNION ALL SELECT 'D',N'鵽'
UNION ALL SELECT 'E',N'樲'
UNION ALL SELECT 'F',N'鰒'
UNION ALL SELECT 'G',N'腂'
UNION ALL SELECT 'H',N'夻'
UNION ALL SELECT 'J',N'攈'
UNION ALL SELECT 'K',N'穒'
UNION ALL SELECT 'L',N'鱳'
UNION ALL SELECT 'M',N'旀'
UNION ALL SELECT 'N',N'桛'
UNION ALL SELECT 'O',N'漚'
UNION ALL SELECT 'P',N'曝'
UNION ALL SELECT 'Q',N'囕'
UNION ALL SELECT 'R',N'鶸'
UNION ALL SELECT 'S',N'蜶'
UNION ALL SELECT 'T',N'籜'
UNION ALL SELECT 'W',N'鶩'
UNION ALL SELECT 'X',N'鑂'
UNION ALL SELECT 'Y',N'韻'
UNION ALL SELECT 'Z',N'做'
) T
WHERE WORD>=@WORD COLLATE CHINESE_PRC_CS_AS_KS_WS
ORDER BY PY ASC
)
ELSE @WORD
END)
SET @STR=RIGHT(@STR,LEN(@STR)-1)
END
RETURN @PY end declare @re nvarchar(max),@crs nvarchar(10)
declare @strlen int
select @strlen=len(@str),@re=''
while @strlen>0
begin
set @crs= substring(@str,@strlen,1)
select @re=
CASE
when @crs<'吖' COLLATE Chinese_PRC_CS_AS_KS_WS then @crs
when @crs<='厑' COLLATE Chinese_PRC_CS_AS_KS_WS then 'A'
when @crs<='靉' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ai'
when @crs<='黯' COLLATE Chinese_PRC_CS_AS_KS_WS then 'An'
when @crs<='醠' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ang'
when @crs<='驁' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ao'
when @crs<='欛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ba'
when @crs<='瓸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bai'
when @crs<='瓣' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ban'
when @crs<='鎊' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bang'
when @crs<='鑤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bao'
when @crs<='鐾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bei'
when @crs<='輽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ben'
when @crs<='鏰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Beng'
when @crs<='鼊' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bi'
when @crs<='變' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bian'
when @crs<='鰾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Biao'
when @crs<='彆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bie'
when @crs<='鬢' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bin'
when @crs<='靐' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bing'
when @crs<='蔔' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bo'
when @crs<='簿' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Bu'
when @crs<='囃' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ca'
when @crs<='乲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cai'
when @crs<='爘' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Can'
when @crs<='賶' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cang'
when @crs<='鼜' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cao'
when @crs<='簎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ce'
when @crs<='笒' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cen'
when @crs<='乽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ceng'
when @crs<='詫' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cha'
when @crs<='囆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chai'
when @crs<='顫' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chan'
when @crs<='韔' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chang'
when @crs<='觘' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chao'
when @crs<='爡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Che'
when @crs<='讖' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chen'
when @crs<='秤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cheng'
when @crs<='鷘' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chi'
when @crs<='銃' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chong'
when @crs<='殠' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chou'
when @crs<='矗' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chu'
when @crs<='踹' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chuai'
when @crs<='鶨' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chuan'
when @crs<='愴' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chuang'
when @crs<='顀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chui'
when @crs<='蠢' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chun'
when @crs<='縒' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Chuo'
when @crs<='嗭' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ci'
when @crs<='謥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cong'
when @crs<='輳' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cou'
when @crs<='顣' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cu'
when @crs<='爨' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cuan'
when @crs<='臎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cui'
when @crs<='籿' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cun'
when @crs<='錯' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Cuo'
when @crs<='橽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Da'
when @crs<='靆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dai'
when @crs<='饏' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dan'
when @crs<='闣' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dang'
when @crs<='纛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dao'
when @crs<='的' COLLATE Chinese_PRC_CS_AS_KS_WS then 'De'
when @crs<='扽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Den'
when @crs<='鐙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Deng'
when @crs<='螮' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Di'
when @crs<='嗲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dia'
when @crs<='驔' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dian'
when @crs<='鑃' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Diao'
when @crs<='嚸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Die'
when @crs<='顁' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ding'
when @crs<='銩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Diu'
when @crs<='霘' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dong'
when @crs<='鬭' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dou'
when @crs<='蠹' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Du'
when @crs<='叾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Duan'
when @crs<='譵' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dui'
when @crs<='踲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Dun'
when @crs<='鵽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Duo'
when @crs<='鱷' COLLATE Chinese_PRC_CS_AS_KS_WS then 'E'
when @crs<='摁' COLLATE Chinese_PRC_CS_AS_KS_WS then 'En'
when @crs<='鞥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Eng'
when @crs<='樲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Er'
when @crs<='髮' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fa'
when @crs<='瀪' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fan'
when @crs<='放' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fang'
when @crs<='靅' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fei'
when @crs<='鱝' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fen'
when @crs<='覅' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Feng'
when @crs<='梻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fo'
when @crs<='鴀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fou'
when @crs<='猤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Fu'
when @crs<='魀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ga'
when @crs<='瓂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gai'
when @crs<='灨' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gan'
when @crs<='戇' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gang'
when @crs<='鋯' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gao'
when @crs<='獦' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ge'
when @crs<='給' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gei'
when @crs<='搄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gen'
when @crs<='堩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Geng'
when @crs<='兣' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gong'
when @crs<='購' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gou'
when @crs<='顧' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gu'
when @crs<='詿' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gua'
when @crs<='恠' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Guai'
when @crs<='鱹' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Guan'
when @crs<='撗' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Guang'
when @crs<='鱥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gui'
when @crs<='謴' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Gun'
when @crs<='腂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Guo'
when @crs<='哈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ha'
when @crs<='饚' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hai'
when @crs<='鶾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Han'
when @crs<='沆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hang'
when @crs<='兞' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hao'
when @crs<='靏' COLLATE Chinese_PRC_CS_AS_KS_WS then 'He'
when @crs<='嬒' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hei'
when @crs<='恨' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hen'
when @crs<='堼' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Heng'
when @crs<='鬨' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hong'
when @crs<='鱟' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hou'
when @crs<='鸌' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hu'
when @crs<='蘳' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hua'
when @crs<='蘾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Huai'
when @crs<='鰀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Huan'
when @crs<='鎤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Huang'
when @crs<='顪' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hui'
when @crs<='諢' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Hun'
when @crs<='夻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Huo'
when @crs<='驥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ji'
when @crs<='嗧' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jia'
when @crs<='鑳' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jian'
when @crs<='謽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jiang'
when @crs<='釂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jiao'
when @crs<='繲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jie'
when @crs<='齽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jin'
when @crs<='竸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jing'
when @crs<='蘔' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jiong'
when @crs<='欍' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jiu'
when @crs<='爠' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ju'
when @crs<='羂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Juan'
when @crs<='钁' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jue'
when @crs<='攈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Jun'
when @crs<='鉲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ka'
when @crs<='乫' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kai'
when @crs<='矙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kan'
when @crs<='閌' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kang'
when @crs<='鯌' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kao'
when @crs<='騍' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ke'
when @crs<='褃' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ken'
when @crs<='鏗' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Keng'
when @crs<='廤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kong'
when @crs<='鷇' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kou'
when @crs<='嚳' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ku'
when @crs<='骻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kua'
when @crs<='鱠' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kuai'
when @crs<='窾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kuan'
when @crs<='鑛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kuang'
when @crs<='鑎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kui'
when @crs<='睏' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kun'
when @crs<='穒' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Kuo'
when @crs<='鞡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'La'
when @crs<='籟' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lai'
when @crs<='糷' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lan'
when @crs<='唥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lang'
when @crs<='軂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lao'
when @crs<='餎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Le'
when @crs<='脷' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lei'
when @crs<='睖' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Leng'
when @crs<='瓈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Li'
when @crs<='倆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lia'
when @crs<='纞' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lian'
when @crs<='鍄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Liang'
when @crs<='瞭' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Liao'
when @crs<='鱲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lie'
when @crs<='轥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lin'
when @crs<='炩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ling'
when @crs<='咯' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Liu'
when @crs<='贚' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Long'
when @crs<='鏤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lou'
when @crs<='氇' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lu'
when @crs<='鑢' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lv'
when @crs<='亂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Luan'
when @crs<='擽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lue'
when @crs<='論' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Lun'
when @crs<='鱳' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Luo'
when @crs<='嘛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ma'
when @crs<='霢' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mai'
when @crs<='蘰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Man'
when @crs<='蠎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mang'
when @crs<='唜' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mao'
when @crs<='癦' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Me'
when @crs<='嚜' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mei'
when @crs<='們' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Men'
when @crs<='霥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Meng'
when @crs<='羃' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mi'
when @crs<='麵' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mian'
when @crs<='廟' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Miao'
when @crs<='鱴' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mie'
when @crs<='鰵' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Min'
when @crs<='詺' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ming'
when @crs<='謬' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Miu'
when @crs<='耱' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mo'
when @crs<='麰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mou'
when @crs<='旀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Mu'
when @crs<='魶' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Na'
when @crs<='錼' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nai'
when @crs<='婻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nan'
when @crs<='齉' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nang'
when @crs<='臑' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nao'
when @crs<='呢' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ne'
when @crs<='焾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nei'
when @crs<='嫩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nen'
when @crs<='能' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Neng'
when @crs<='嬺' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ni'
when @crs<='艌' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nian'
when @crs<='釀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Niang'
when @crs<='脲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Niao'
when @crs<='钀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nie'
when @crs<='拰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nin'
when @crs<='濘' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ning'
when @crs<='靵' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Niu'
when @crs<='齈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nong'
when @crs<='譳' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nou'
when @crs<='搙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nu'
when @crs<='衄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nv'
when @crs<='瘧' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nue'
when @crs<='燶' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nuan'
when @crs<='桛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Nuo'
when @crs<='鞰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'O'
when @crs<='漚' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ou'
when @crs<='袙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pa'
when @crs<='磗' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pai'
when @crs<='鑻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pan'
when @crs<='胖' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pang'
when @crs<='礮' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pao'
when @crs<='轡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pei'
when @crs<='喯' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pen'
when @crs<='喸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Peng'
when @crs<='鸊' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pi'
when @crs<='騙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pian'
when @crs<='慓' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Piao'
when @crs<='嫳' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pie'
when @crs<='聘' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pin'
when @crs<='蘋' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ping'
when @crs<='魄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Po'
when @crs<='哛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pou'
when @crs<='曝' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Pu'
when @crs<='蟿' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qi'
when @crs<='髂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qia'
when @crs<='縴' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qian'
when @crs<='瓩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qiang'
when @crs<='躈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qiao'
when @crs<='籡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qie'
when @crs<='藽' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qin'
when @crs<='櫦' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qing'
when @crs<='瓗' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qiong'
when @crs<='糗' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qiu'
when @crs<='覻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qu'
when @crs<='勸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Quan'
when @crs<='礭' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Que'
when @crs<='囕' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Qun'
when @crs<='橪' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ran'
when @crs<='讓' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Rang'
when @crs<='繞' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Rao'
when @crs<='熱' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Re'
when @crs<='餁' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ren'
when @crs<='陾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Reng'
when @crs<='馹' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ri'
when @crs<='穃' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Rong'
when @crs<='嶿' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Rou'
when @crs<='擩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ru'
when @crs<='礝' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ruan'
when @crs<='壡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Rui'
when @crs<='橍' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Run'
when @crs<='鶸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ruo'
when @crs<='栍' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sa'
when @crs<='虄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sai'
when @crs<='閐' COLLATE Chinese_PRC_CS_AS_KS_WS then 'San'
when @crs<='喪' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sang'
when @crs<='髞' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sao'
when @crs<='飋' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Se'
when @crs<='篸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sen'
when @crs<='縇' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Seng'
when @crs<='霎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sha'
when @crs<='曬' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shai'
when @crs<='鱔' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shan'
when @crs<='緔' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shang'
when @crs<='潲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shao'
when @crs<='欇' COLLATE Chinese_PRC_CS_AS_KS_WS then 'She'
when @crs<='瘮' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shen'
when @crs<='賸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sheng'
when @crs<='瓧' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shi'
when @crs<='鏉' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shou'
when @crs<='虪' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shu'
when @crs<='誜' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shua'
when @crs<='卛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shuai'
when @crs<='腨' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shuan'
when @crs<='灀' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shuang'
when @crs<='睡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shui'
when @crs<='鬊' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shun'
when @crs<='鑠' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Shuo'
when @crs<='乺' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Si'
when @crs<='鎹' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Song'
when @crs<='瘶' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sou'
when @crs<='鷫' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Su'
when @crs<='算' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Suan'
when @crs<='鐩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sui'
when @crs<='潠' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Sun'
when @crs<='蜶' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Suo'
when @crs<='襨' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ta'
when @crs<='燤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tai'
when @crs<='賧' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tan'
when @crs<='燙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tang'
when @crs<='畓' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tao'
when @crs<='蟘' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Te'
when @crs<='朰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Teng'
when @crs<='趯' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ti'
when @crs<='舚' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tian'
when @crs<='糶' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tiao'
when @crs<='餮' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tie'
when @crs<='乭' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ting'
when @crs<='憅' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tong'
when @crs<='透' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tou'
when @crs<='鵵' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tu'
when @crs<='褖' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tuan'
when @crs<='駾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tui'
when @crs<='坉' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tun'
when @crs<='籜' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Tuo'
when @crs<='韤' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wa'
when @crs<='顡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wai'
when @crs<='贎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wan'
when @crs<='朢' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wang'
when @crs<='躛' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wei'
when @crs<='璺' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wen'
when @crs<='齆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Weng'
when @crs<='齷' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wo'
when @crs<='鶩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Wu'
when @crs<='衋' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xi'
when @crs<='鏬' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xia'
when @crs<='鼸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xian'
when @crs<='鱌' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xiang'
when @crs<='斆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xiao'
when @crs<='躞' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xie'
when @crs<='釁' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xin'
when @crs<='臖' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xing'
when @crs<='敻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xiong'
when @crs<='齅' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xiu'
when @crs<='蓿' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xu'
when @crs<='贙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xuan'
when @crs<='瀥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xue'
when @crs<='鑂' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Xun'
when @crs<='齾' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ya'
when @crs<='灩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yan'
when @crs<='樣' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yang'
when @crs<='鑰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yao'
when @crs<='岃' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ye'
when @crs<='齸' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yi'
when @crs<='檼' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yin'
when @crs<='譍' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ying'
when @crs<='喲' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yo'
when @crs<='醟' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yong'
when @crs<='鼬' COLLATE Chinese_PRC_CS_AS_KS_WS then 'You'
when @crs<='爩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yu'
when @crs<='願' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yuan'
when @crs<='鸙' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yue'
when @crs<='韻' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Yun'
when @crs<='雥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Za'
when @crs<='縡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zai'
when @crs<='饡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zan'
when @crs<='臟' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zang'
when @crs<='竈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zao'
when @crs<='稄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Ze'
when @crs<='鱡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zei'
when @crs<='囎' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zen'
when @crs<='贈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zeng'
when @crs<='醡' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zha'
when @crs<='瘵' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhai'
when @crs<='驏' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhan'
when @crs<='瞕' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhang'
when @crs<='羄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhao'
when @crs<='鷓' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhe'
when @crs<='黮' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhen'
when @crs<='證' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zheng'
when @crs<='豒' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhi'
when @crs<='諥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhong'
when @crs<='驟' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhou'
when @crs<='鑄' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhu'
when @crs<='爪' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhua'
when @crs<='跩' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhuai'
when @crs<='籑' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhuan'
when @crs<='戅' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhuang'
when @crs<='鑆' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhui'
when @crs<='稕' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhun'
when @crs<='籱' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zhuo'
when @crs<='漬' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zi'
when @crs<='縱' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zong'
when @crs<='媰' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zou'
when @crs<='謯' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zu'
when @crs<='攥' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zuan'
when @crs<='欈' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zui'
when @crs<='銌' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zun'
when @crs<='咗' COLLATE Chinese_PRC_CS_AS_KS_WS then 'Zuo'
else @crs end+@re,@strlen=@strlen-1
end
return(@re)
END
调用如下:
select dbo.fn_getpy(realname,0) as quanpin,dbo.fn_getpy(realname,1) as shouzimu,realname,depart from staff
实现首字母或拼音检索-sql语句方式的更多相关文章
- js汉语转拼音(全拼、首字母、拼音首字母)
新建js文件first_alphabet.js // JavaScript Document // 汉字拼音首字母列表 本列表包含了20902个汉字,用于配合 ToChineseSpell //函数使 ...
- SQLSERVER中汉字提取首字母的拼音函数的实现
--创建一个汉字提取首字母的函数--还存在一点小小的问题(符号?)create function hs(@a varchar(1000)='')returns varchar(1000)asbegin ...
- jsp 下拉框首字母定位可检索
实现效果如图: 页面部分: (1)js中: (2)body中: JAVA代码部分: 控制器Controller中 写一个页面js中调用的方法: 引入jar包:
- 获取汉字首字母,拼音,可实现拼音字母搜索----npm js-pinyin
npm install js-pinyin main.js 引入 import pinyin from 'js-pinyin' 使用组件内 let pinyin = require('js- ...
- 在.net core web 项目中操作MySql数据库(非ORM框架,原生sql语句方式)
本案例通过MySql.Data和Dapper包执行原生sql,实现对数据库的操作. 操作步骤: 第1步:在MySql数据库中新建表User(使用Navicat For MySql工具) 建表语句: c ...
- js首字母大写--单个单词的处理方式
var operate2='OR'; for (var j = 0, len = operate1.length; j< len; j++) { //获得unicode码 var ch2 = o ...
- oracle汉字转拼音(获得全拼/拼音首字母/拼音截取等)
oracle汉字转拼音(获得全拼/拼音首字母/拼音截取等) 效果如下: Oracle 字符集 GBK 没有问题 , UTF -8 需要修改一下 Sql代码 --oracle汉字转拼 ...
- vue 实现模糊检索,并根据其他字符的首字母顺序排列
昨天让我做一个功能,实现一个模糊检索,我就想,那做呗,然后开始正常的开发 代码如下: HTML VUE 因为是实时的,所以写了将逻辑写到了watch中 五分钟搞定. 我以为这就完了,然而产品的需求 ...
- 简单测试--C#实现中文汉字转拼音首字母
第一种: 这个是自己写的比较简单的实现方法,要做汉字转拼音首字母,首先应该有一个存储首字母的数组,然后将要转拼音码的汉字与每个首字母开头的第一个汉字即“最小”的汉字作比较,这里的最小指的是按拼音规则比 ...
随机推荐
- 关于12C中optimizer_adaptive_features参数介绍
optimizer_adaptive_features参数在OLAP数据仓库环境中可以获得较好的效果,实际在重上传轻查询的OLTP系统上,可以关闭这项新功能. 其主要功能是为了在语句执行过程中实时收集 ...
- 《linux就该这么学》第七节课:文件的各种权限以及linux分区命名规则
笔记 (借鉴请改动) 5.3:文件特殊权限 SUID 临时拥有文件所有者的权限(基本上只是执行权限) SGID 临时拥有文件所有组的权限,在目录中创建文件自动继承该目录的用户组. SBIT 粘滞 ...
- Centos 忘记root密码怎么办?
1 - 在启动grub菜单,选择编辑选项启动 2 - 按键盘e键,来进入编辑界面 3 - 找到Linux 16的那一行,将ro改为rw init=/sysroot/bin/sh 4 - 现在按下 Co ...
- 213. House Robber II(动态规划)
You are a professional robber planning to rob houses along a street. Each house has a certain amount ...
- NOIP2015跳石头
题目描述 Description 一年一度的“跳石头”比赛又要开始了! 这项比赛将在一条笔直的河道中进行,河道中分布着一些巨大岩石.组委会已经选择好了两块岩石作为比赛起点和终点.在起点和终点之间,有N ...
- 浅探网络1---tcp协议详解(三次握手和四次挥手)
TCP协议是网络多层协议中运输层的最重要的协议之一,运输层是两台主机的进程之间的通信.除了TCP还有一个是UDP协议(用户数据包协议) TCP全称是Transmission Control Proto ...
- win10忘记开机密码无法进入桌面
第一种: 电脑用微软账户登录,但密码始终不正确. 登陆这个网址 https://account.live.com/password/reset 按照提示的操作利用之前注册信息一步步重设密码 最后 ...
- 论文笔记【二】Making Sense of Word Embeddings
摘要 1.作者提出了一种新的简单有效的方法,用于学习词义嵌入word sense embedding 2.传统的两种方法:(1)直接从语料库中学习词义:(2)依赖词汇资源的语义库 研究方法的创新点:通 ...
- 【一些容易忘记的node的npm命令】【收集】
更新npm到最新版本 npm update -g npm 安装依赖包时命令的一些区别 npm install xxx -g //(全局安装) npm install xxx --save-dev // ...
- Uncertainty
I did'nt know where i was supposed to be, until i'd actually arrived.