Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Acquisition of Chinese character mnemonic codes by sqlserver

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

First of all, create a function whose function is to get the first letter of Chinese phonetic alphabet.

Go

If exists (select * from sysobjects where name='fun_getPY' and xtype='Fn')

Begin

Drop function fun_getPY

End

Go

Create function fun_getPY (@ str nvarchar (4000))

/ * get the first letter of Chinese pinyin * /

Returns nvarchar (4000)

As

Begin

Declare @ word nchar (1), @ PY nvarchar (4000)

Set @ PY=''

While len (@ str) > 0

Begin

Set @ word=left (@ str,1)

If it is not a Chinese character, the original character is returned.

Set @ PY=@PY+ (case when unicode (@ word) between 19968 and

Then (select top 1 PY from (

Select'A'as PY,N' girls'as word

Union all select 'Bamboo Magazine N' Book'

Union all select 'Cummings'.

Union all select 'Dracula Magnum N'Lou'

Union all select'Efficient Magnum N'Fountain'

Union all select'Fengjingjinghuo'.

Union all select'Grain Magnum N'Our'

Union all select'Hangjia Magnum N'Fang'

Union all select'Jun Jun Magi N'Qing'

Union all select 'Kendall Magnum N'Yun'

Union all select 'Lindsey'.

Union all select'M é cor Magi N'em'

Union all select 'Nice, Magnum,'

Union all select 'Olympian'.

Union all select'Please Magnum N 'expose'

Union all select 'Qiang Magi N'Qing'

Union all select'Rongjia Magnum N'Fountain'

Union all select'Scripture Magnum N'em'

Union all select'Thoujinghorn 'ice'

Union all select 'Warriors'.

Union all select 'Xanthology, Magnum N'.

Union all select 'Yizhi, Magnum N'

Union all select 'Zhai'.

) 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

Go

-- function call example 1: generate mnemonic codes for specified characters

Select dbo.fun_getPY ('China-Zhengzhou') FhelperCode

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report