sqlServer 獲取漢字字串的拼音聲母
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)文章
SQLServer中用T—SQL命令查詢一個(gè)數(shù)據(jù)庫(kù)中有哪些表的sql語(yǔ)句
SQLServer如何用T—SQL命令查詢一個(gè)數(shù)據(jù)庫(kù)中有哪些表,方便進(jìn)行表操作,需要的朋友可以參考下2012-06-06
如何恢復(fù)SQL Server 2000損壞的數(shù)據(jù)庫(kù)文件
在現(xiàn)實(shí)情況中由于硬件和軟件的原因可能導(dǎo)致數(shù)據(jù)庫(kù)文件損壞,那么損壞的數(shù)據(jù)庫(kù)文件有沒(méi)有辦法修復(fù)呢?下面講講如何恢復(fù)SQL Server 2000損壞的數(shù)據(jù)庫(kù)文件2014-01-01
SQL Server2019數(shù)據(jù)庫(kù)備份與還原腳本(批量備份)
本文主要介紹了SQL Server2019數(shù)據(jù)庫(kù)備份與還原腳本,數(shù)據(jù)庫(kù)可批量備份,文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-11-11
SQL Server 2016 CTP2.3 的關(guān)鍵特性總結(jié)
SQL Server2016 CTP2.2是微軟數(shù)據(jù)平臺(tái)歷史上邁出最大的一步,更快的事務(wù)處理和查詢、任何設(shè)備更深入的洞察力、更先進(jìn)的分析能力、全新安全技術(shù)和全新的混合云場(chǎng)景,本文給大家介紹SQL Server 2016 CTP2.3 的關(guān)鍵特性總結(jié),需要的朋友可以參考下2015-09-09
SQL語(yǔ)句刪除2條重復(fù)數(shù)據(jù)一條保留一條
SQL語(yǔ)句2條完全一樣的數(shù)據(jù)刪除一條保留一條,SQL Server 2005 Express 下測(cè)試通過(guò), 僅供參考2012-06-06
多列復(fù)合索引的使用 繞過(guò)微軟sql server的一個(gè)缺陷
多列復(fù)合索引是指由多個(gè)字段組成的索引。這種情況相當(dāng)常用的,并且,在查詢中,用多列復(fù)合索引來(lái)指定搜索范圍邊界也相當(dāng)常用2012-07-07
實(shí)現(xiàn)SQL分頁(yè)的存儲(chǔ)過(guò)程代碼
本文主要介紹了分頁(yè)的存儲(chǔ)過(guò)程所實(shí)現(xiàn)代碼,使用存儲(chǔ)過(guò)程可以提高效率與節(jié)約時(shí)間,需要的朋友可以參考下2015-08-08
在SQL Server數(shù)據(jù)庫(kù)中為標(biāo)識(shí)(IDENTITY)列插入顯式值
SQL Server中的標(biāo)識(shí)列和ACCESS中的“自動(dòng)編號(hào)”相似,都是插入記錄的時(shí)候自動(dòng)生成,一般不允許也不需要我們?nèi)ナ謩?dòng)修改它2007-02-02

