SQL Kanji to Pinyin

Source: Internet
Author: User

/* Create pinyin First letter function */
Create function [dbo]. [Fn_chinesetospell] (@strChinese varchar (500) = ")
Returns varchar (500)
As
Begin/* Function implementation Start */
declare @strLen int, @return varchar ($), @i int
DECLARE @n int,@c char (1), @chn nchar (1)
Select @strLen =len (@strChinese), @return = ", @i=0
While @i< @strLen
Begin/*while Cycle Start */
Select @[email protected]+1,@n=63, @chn =substring (@strChinese, @i,1)
If @chn > ' z '/* principle: "string sorting and ASCII code table" */
Select @n = @n +1,@c =case CHN when @chn then char (@n) Else @c end from (select-Top + from (select CHN = ' acridine ' UNION ALL s) Elect ' Eight ' union all select ' Cha ' union ALL Select ' Otah ' union ALL SELECT ' Ehegan ' union ALL SELECT ' Send ' union ALL select ' Xu ' Unio n All select ' hafnium ' union ALL SELECT ' not '/*because have no ' I '/UNION ALL SELECT ' NOT ' union ALL select ' KA ' UNION ALL Select ' Garbage ' union ALL SELECT ' 嘸 ' union ALL SELECT ' Hallasan ' UNION ALL SELECT ' Oh ' UNION ALL SELECT ' 妑 ' UNION ALL select ' Seven ' UNION ALL SEL ECT ' 呥 ' UNION ALL SELECT ' Three ' union ALL select ' He ' union ALL select ' 屲 '/*no ' u ' */UNION ALL SELECT ' 屲 '/*no ' V ' */union AL L SELECT ' 屲 ' union ALL SELECT ' XI ' union ALL Select ' Ya ' union ALL SELECT ' as ' union ALL select @chn) as a order by CHN COLL ATE chinese_prc_ci_as) as B
Else
Set @[email protected]
Set @[email Protected][email protected]
End/*while Cycle Ends */
Return (@return)
End/* Function implementation ends */

SELECT [dbo]. [Fn_chinesetospell] (' plumbing ')

SQL Kanji to Pinyin

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.