SQL Chinese to Pinyin first letter

Source: Internet
Author: User

http://blog.csdn.net/zhanglong_longlong/article/details/46772571

--can support 20,000 characters of large character set!CreatefunctionF_ch2py (@chn nchar (1)) returns char (1) asbeginDeclare@n intDeclare@c Char (1) Set @n= 63Select @n= @n +1,@c= CaseCHN when @chn then char (@n)Else@cEndFrom (select top27 *From (select CHN= ' Acridine 'UNION ALL SelectEightUNION ALL SelectChaUNION ALL SelectOtahUNION ALL SelectEheganUNION ALL SelectHairUNION ALL SelectXuUNION ALL SelectHafniumUNION ALL Select' Not ' union ALL select--because has no ' i 'UNION ALL SelectCarbazoleUNION ALL SelectLaUNION ALL Select' 嘸 'UNION ALL SelectHallasanUNION ALL SelectOhUNION ALL Select' 妑 'UNION ALL SelectSevenUNION ALL Select' 呥 'UNION ALL SelectThreeUNION ALL SelectHeUNION ALL Select' 屲 ' UNION ALL select--no ' u ' 屲 ' UNION ALL select--no ' V ' 屲 'UNION ALL SelectYubariUNION ALL SelectYaUNION ALL Select' As ' union ALL select @chn) asAorder by CHN COLLATE chinese_prc_ci_as) asbreturn(@c)Endgoselect dbo. f_ch2py (' Medium ')--zselect dbo. F_ch2py (' country ')--gselect dbo. F_ch2py (' People ')--rselect dbo. F_ch2py (' HSW ')--Mgo-----------------Call CreateFUNCTIONF_gethelpcode (@cName VARCHAR (20)) RETURNS VARCHAR (12) asBEGINDECLARE@i SMALLINT, @l SMALLINT, @cHelpCode varchar (), @e varchar (12),@iAscii SMALLINT SELECT @i=1, @l=0, @cHelpCode = " while@l<=12 and @i<=LEN (@cName) BEGIN SELECT @e=lower (SUBSTRING (@cname, @i,1)) SELECT @iAscii=ASCII (@e)IF@iAscii >=48 and @iAscii <=57 or @iAscii >=97 and @iAscii <=122 or @iAscii =95SELECT @cHelpCode[Email protected] +@eELSE      IF@iAscii >=176 and @iAscii <=247SELECT @cHelpCode[Email protected] + dbo.f_ch2py (@e)ELSESELECT @[email protected]SELECT @i[Email protected]+1, @[email protected]+1END     RETURN@cHelpCodeENDGO--Call SELECT dbo. F_gethelpcode (' vigorously ')

SQL Chinese to Pinyin first letter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.