使用下方的函式..
忘了從哪抄的了..留存乙份
如果只要首字母..建議將資料 left(tablefiled,1) 後傳入函式
如果欄位是空或者null, 不會報錯..返回空
方法體:
set ansi_nulls ongoset quoted_identifier on
gocreate
function
[dbo
].[f_sys_getpy](
@str
nvarchar(4000))
returns
nvarchar(4000)as
begin
declare
@word
nchar(1),@py
nvarchar(4000
)set
@py=
''while
len(@str)>
0begin
set@word
=left(@str,1
)set
@py=
@py+(case
when
unicode(@word) between
19968
and19968
+20901
then (select
top1 py from
(select'a
'as py,n'驁'
asword
union
allselect'b
',n'簿'
union
allselect'c
',n'錯'
union
allselect'd
',n'鵽'
union
allselect'e
',n'樲'
union
allselect'f
',n'鰒'
union
allselect'g
',n'腂'
union
allselect'h
',n'夻'
union
allselect'j
',n'攈'
union
allselect'k
',n'穒'
union
allselect'l
',n'鱳'
union
allselect'm
',n'旀'
union
allselect'n
',n'桛'
union
allselect'o
',n'漚'
union
allselect'p
',n'曝'
union
allselect'q
',n'囕'
union
allselect'r
',n'鶸'
union
allselect's
',n'蜶'
union
allselect't
',n'籜'
union
allselect'w
',n'鶩'
union
allselect'x
',n'鑂'
union
allselect'y
',n'韻'
union
allselect'z
',n'咗'
) twhere word>=
@word
collate chinese_prc_cs_as_ks_ws
order
by py asc) else
@word
end)
set@str
=right(@str,len(@str)-1)
endreturn
@pyend
go
中文轉拼音
中文轉拼音的類c 實現 code using system using system.collections.generic using system.text using system.collections endregion 獲得漢字的拼音,如果輸入的是英文本元將原樣輸出,中文標點符號將被忽略...
Flex中文轉拼音
package return ret param char unicode格式的乙個中文字元 return 中文字元的聲母 example var chinesechar string 我 var py string convert.convertchar chinesechar trace py ...
iOS 中文轉拼音
cfstringtransform 這篇文章後,發現系統本身已經提供了乙個這樣的函式。ios在corefoundation中提供了cfstringtransform函式,但在foundation中卻沒有相對應的方法。它的定義如下 boolean cfstringtransform cfmutable...