排序規則在拼音處理中的應用 sql

2021-09-08 03:32:08 字數 1845 閱讀 8012

--1. 按拼音排序

declare @t table(col varchar(2))

insert @t select '中'

union all select '國'

union all select '人'

select * from @t order by col collate chinese_prc_cs_as_ks_ws

/*--結果

col  

---- 國

人 中

--*/

go/*****************************************==*/

--2. 漢字首字母查詢處理使用者定義函式

create function f_getpy(@str nvarchar(4000))

returns nvarchar(4000)

asbegin

declare @py table(

ch char(1),

hz1 nchar(1) collate chinese_prc_cs_as_ks_ws,

hz2 nchar(1) collate chinese_prc_cs_as_ks_ws)

insert @py select 'a',n'吖',n'鏊'

union  all select 'b',n'八',n'簿'

union  all select 'c',n'嚓',n'錯'

union  all select 'd',n'噠',n'跺'

union  all select 'e',n'屙',n'貳'

union  all select 'f',n'發',n'馥'

union  all select 'g',n'旮',n'過'

union  all select 'h',n'鉿',n'蠖'

union  all select 'j',n'丌',n'竣'

union  all select 'k',n'咔',n'廓'

union  all select 'l',n'垃',n'雒'

union  all select 'm',n'媽',n'穆'

union  all select 'n',n'拿',n'糯'

union  all select 'o',n'噢',n'漚'

union  all select 'p',n'趴',n'曝'

union  all select 'q',n'七',n'群'

union  all select 'r',n'蚺',n'箬'

union  all select 's',n'仨',n'鎖'

union  all select 't',n'他',n'籜'

union  all select 'w',n'哇',n'鋈'

union  all select 'x',n'夕',n'蕈'

union  all select 'y',n'丫',n'蘊'

union  all select 'z',n'匝',n'做'

declare @i int

set @i=patindex('%[吖-做]%' collate chinese_prc_cs_as_ks_ws,@str)

while @i>0

select @str=replace(@str,substring(@str,@i,1),ch)

,@i=patindex('%[吖-做]%' collate chinese_prc_cs_as_ks_ws,@str)

from @py

where substring(@str,@i,1) between hz1 and hz2

return(@str)

endgo

sqlserver排序規則在拼音處理中的應用

1.按拼音排序 declare t table col varchar 2 insert t select 中 union all select 國 union all select 家 union all select 人 union all select 郭 select from t orde...

關聯規則在銀行訪問款業務中的 應用

摘要 在我國,商業銀行是金融體系的主體,也是我國國民經濟的命脈。隨著2006年我國對外資銀行實行國民待遇,中國的銀行業開始面臨愈發激烈的市場競爭。如何提公升我國商業銀行的國際競爭力,進而確保中國金融體系和國民經濟健康穩定地發展在現階段顯得尤為重要。而效率是銀行競爭力的集中體現,只有提高了我國商業銀行...

正則在小偷程式中的應用 續

獲取資源資訊 content file get contents time 對抓取的資訊進行處理。取class為listtable的表資訊。匹配除 外的所有字元。用的是懶惰限定符,代表重複任意次,但盡量少重複。即匹配最短的以 class listtable table s content,out 抓...