In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge about "sql storage procedure to obtain the method of Chinese phonetic first letter function". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
The copy code is as follows:
--function CREATE fn_GetPy (@str nvarchar(4000)) returns nvarchar(4000) --WITH ENCRYPTION as begin declare @intLenint declare @strRetnvarchar(4000) declare @temp nvarchar(100) set @intLen = len(@str) set @strRet = '' while @intLen > 0 begin set @temp = '' select @temp = case when substring (@str,@intLen,1) >= '帀' then 'Z' when substring (@str,@intLen,1) >= 'Y' then 'Y' when substring (@str,@intLen,1) >= 'Xi' then 'X' when substring (@str,@intLen,1) >= '屲' then 'W' when substring (@str,@intLen,1) >= 'he' then 'T' when substring (@str,@intLen,1) >= 'three' then 'S' when substring (@str,@intLen,1) >= '呥' then 'R' when substring (@str,@intLen,1) >= 'seven' then 'Q' when substring (@str,@intLen,1) >= '妑' then 'P' when substring (@str,@intLen,1) >= 'oh' then 'O' when substring (@str,@intLen,1) >= '拏' then 'N' when substring (@str,@intLen,1) >= 'M' then 'M' when substring (@str,@intLen,1) >= 'La' then 'L' when substring (@str,@intLen,1) >= 'Ka' then 'K' when substring (@str,@intLen,1) >= '丌' then 'J' when substring (@str,@intLen,1) >= 'hafnium' then 'H' when substring (@str,@intLen,1) >= '' then 'G' when substring (@str,@intLen,1) >= 'send' then 'F' when substring (@str,@intLen,1) >= '妸' then 'E' when substring (@str,@intLen,1) >= '咑' then 'D' when substring (@str,@intLen,1) >= '' then 'C' when substring (@str,@intLen,1) >= 'eight' then 'B' when substring (@str,@intLen,1) >= 'a' then 'A' else rtrim (ltrim(substring(@str,@intLen,1))) end --For special Chinese characters, do not generate phonetic code if (ascii(@temp)>127) set @temp = '' --For parenthesis, Do not generate phonetic code if @temp = '(' or @temp =')' set @temp =''select @strRet = @temp + @strRet set @intLen = @intLen - 1 end return lower(@strRet) end go --invoke select dbo.fn_getpy ('Zhang San')--Return: zs answer!:2: Create function fun_getPY ( @str nvarchar(4000) ) 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 non-Chinese characters, Return original character set @PY=@PY+(case when unicode(@word) between 19968 and 19968+20901 then ( select top 1 PY from ( select 'A' as PY, N'ao ' as word union all select 'B', N'book ' union all select 'C', N'wrong ' 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'rhyme '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"sql stored procedure to obtain the method of Chinese pinyin first letter function" content introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
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.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.