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)文章
SQL Server的通用分頁(yè)存儲(chǔ)過(guò)程 未使用游標(biāo),速度更快!
使用SQL Server時(shí),分頁(yè)處理一直是個(gè)比較棘手的問(wèn)題2010-11-11SQL?Server附加數(shù)據(jù)庫(kù)時(shí)出現(xiàn)錯(cuò)誤的處理方法
通過(guò)附加功能添加現(xiàn)成的數(shù)據(jù)庫(kù)是非常方便的,然而有時(shí)會(huì)出現(xiàn)附加數(shù)據(jù)庫(kù)失敗,下面這篇文章主要給大家介紹了關(guān)于SQL?Server附加數(shù)據(jù)庫(kù)時(shí)出現(xiàn)錯(cuò)誤的處理方法,需要的朋友可以參考下2022-12-12SQL行號(hào)排序和分頁(yè)(SQL查詢中插入行號(hào) 自定義分頁(yè)的另類實(shí)現(xiàn))
如何在SQL中對(duì)行進(jìn)行動(dòng)態(tài)編號(hào),加行號(hào)這個(gè)問(wèn)題,在數(shù)據(jù)庫(kù)查詢中,是經(jīng)典的問(wèn)題2012-07-07SQL數(shù)據(jù)庫(kù)的高級(jí)sql注入的一些知識(shí)
這篇文章討論常用的"sql注入"技術(shù)的細(xì)節(jié),應(yīng)用于流行的Ms IIS/ASP/SQL-Server平臺(tái)。這里探討有關(guān)這種攻擊各種可以注入程序訪問(wèn)數(shù)據(jù)和數(shù)據(jù)庫(kù)防范的方法。2010-03-03使用SQL語(yǔ)句將相同名的多行字段內(nèi)容拼接(方法詳解)
這篇文章主要介紹了使用SQL語(yǔ)句將相同名的多行字段內(nèi)容拼接起來(lái),可以使用GROUP_CONCAT函數(shù)來(lái)實(shí)現(xiàn)相同名稱的多行字段內(nèi)容拼接,本文給大家介紹的非常詳細(xì),需要的朋友可以參考下2023-05-05sqlserver 通用分頁(yè)存儲(chǔ)過(guò)程
sqlserver 通用分頁(yè)存儲(chǔ)過(guò)程,用存儲(chǔ)過(guò)程可以提高效率與節(jié)約時(shí)間。2009-09-09SQL Server中數(shù)學(xué)函數(shù)的用法
這篇文章介紹了SQL Server中數(shù)學(xué)函數(shù)的用法,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-05-05sqlServer 數(shù)據(jù)庫(kù)語(yǔ)法大全
這篇文章主要介紹了sqlServer中數(shù)據(jù)庫(kù)語(yǔ)法,包括數(shù)據(jù)庫(kù)的常用操作方法,需要的朋友可以參考下2013-08-08