/* -------------------------------------------------------------函数: fn_GetPinyin描述: 汉字转拼音(无数据表版)使用: dbo.fn_GetPinyin('中华人民共和国'......
/* ------------------------------------------------------------- 函数: fn_GetPinyin 描述: 汉字转拼音(无数据表版) 使用: dbo.fn_GetPinyin('中华人民共和国') = zhonghuarenmingongheguo 作者: 流香羽 博客: http://hi.baidu.com/流香羽 ------------------------------------------------------------- */
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[fn_GetPinyin]') AND xtype in (N'FN', N'IF', N'TF')) BEGIN execute dbo.sp_executesql @statement = N'create function [dbo].[fn_GetPinyin](@words nvarchar(2000)) returns varchar(8000) as begin declare @word nchar(1) declare @pinyin varchar(8000) declare @i int declare @words_len int declare @unicode int set @pinyin = '''' set @i = 1 set @words = ltrim(rtrim(@words)) set @words_len = len(@words) while (@i <= @words_len) --循环取字符 begin set @word = substring(@words, @i, 1) set @unicode = unicode(@word) set @pinyin = @pinyin (case when unicode(@word) between 19968 and 19968 20901 then (select top 1 py from ( select ''a'' as py,N''厑'' as word union all select ''ai'',N''靉'' union all select ''an'',N''黯'' union all select ''ang'',N''醠'' union all select ''ao'',N''驁'' union all select ''ba'',N''欛'' union all select ''bai'',N''瓸'' --韛兡瓸 union all select ''ban'',N''瓣'' union all select ''bang'',N''鎊'' union all select ''bao'',N''鑤'' union all select ''bei'',N''鐾'' union all select ''ben'',N''輽'' union all select ''beng'',N''鏰'' union all select ''bi'',N''鼊'' union all select ''bian'',N''變'' union all select ''biao'',N''鰾'' union all select ''bie'',N''彆'' union all select ''bin'',N''鬢'' union all select ''bing'',N''靐'' union all select ''bo'',N''蔔'' union all select ''bu'',N''簿'' union all select ''ca'',N''囃'' union all select ''cai'',N''乲'' --縩乲 union all select ''can'',N''爘'' union all select ''cang'',N''賶'' union all select ''cao'',N''鼜'' union all select ''ce'',N''簎'' union all select ''cen'',N''笒'' union all select ''ceng'',N''乽'' --硛硳岾猠乽
1/8 1 2 3 4 5 6 下一页 尾页 |