sqlServer 獲取漢字字串的拼音聲母
更新時間:2009年11月08日 23:46:00 作者:
sqlServer 中 獲取漢字字串的拼音聲母,需要的朋友可以參考下。
復(fù)制代碼 代碼如下:
CREATE function fGetPy(@str varchar(500)='')
returns varchar(500)
as
begin
declare @strlen int,@return varchar(500),@ii int
declare @c nchar(1),@chn nchar(1)
select @strlen=len(@str),@return='',@ii=0
set @ii=0
while @ii<@strlen
begin
select @ii=@ii+1,@chn=substring(@str,@ii,1)
if @chn>='吖'
select @c = char(count(*)+63) from (
select top 27 * from (
select chn = '吖'
union all select '八'
union all select '嚓'
union all select '咑'
union all select '妸'
union all select '發(fā)'
union all select '旮'
union all select '鉿'
union all select '丌' --because have no 'i'
union all select '丌'
union all select '咔'
union all select '垃'
union all select '嘸'
union all select '拏'
union all select '噢'
union all select '妑'
union all select '七'
union all select '呥'
union all select '仨'
union all select '他'
union all select '屲' --no 'u'
union all select '屲' --no 'v'
union all select '屲'
union all select '夕'
union all select '丫'
union all select '帀'
union all select @chn
) as a
order by chn COLLATE Chinese_PRC_CI_AS ) as b
where b.chn <=@chn
else set @c=@chn
set @return=@return+@c
end
return(@return)
end
相關(guān)文章
SQL Server的通用分頁存儲過程 未使用游標(biāo),速度更快!
使用SQL Server時,分頁處理一直是個比較棘手的問題2010-11-11SQL?Server附加數(shù)據(jù)庫時出現(xiàn)錯誤的處理方法
通過附加功能添加現(xiàn)成的數(shù)據(jù)庫是非常方便的,然而有時會出現(xiàn)附加數(shù)據(jù)庫失敗,下面這篇文章主要給大家介紹了關(guān)于SQL?Server附加數(shù)據(jù)庫時出現(xiàn)錯誤的處理方法,需要的朋友可以參考下2022-12-12SQL行號排序和分頁(SQL查詢中插入行號 自定義分頁的另類實現(xiàn))
如何在SQL中對行進(jìn)行動態(tài)編號,加行號這個問題,在數(shù)據(jù)庫查詢中,是經(jīng)典的問題2012-07-07使用SQL語句將相同名的多行字段內(nèi)容拼接(方法詳解)
這篇文章主要介紹了使用SQL語句將相同名的多行字段內(nèi)容拼接起來,可以使用GROUP_CONCAT函數(shù)來實現(xiàn)相同名稱的多行字段內(nèi)容拼接,本文給大家介紹的非常詳細(xì),需要的朋友可以參考下2023-05-05SQL Server中數(shù)學(xué)函數(shù)的用法
這篇文章介紹了SQL Server中數(shù)學(xué)函數(shù)的用法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-05-05