sql 函数 汉字转拼音】的更多相关文章

GO /****** Object: UserDefinedFunction [dbo].[fn_GetPy] Script Date: 2017/1/4 10:53:49 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER function [dbo].[fn_GetPy](@str nvarchar(4000)) returns nvarchar(4000) --用于加密 --WITH ENCRYPTION as be…
ql获取汉字的拼音首字母   if exists (select * from sysobjects where id = object_id(N'[fn_ChineseToSpell]') and xtype in (N'FN', N'IF', N'TF'))    www.2cto.com       drop function [fn_ChineseToSpell] GO /*创建取拼音首字母函数*/  create function [dbo].[fn_ChineseToSpell](@…
有时我们会需要将汉字转为拼音,例如需要将省市转为拼音后当做编码存储(尽管国家有统一的标识码,但有时候我们还是会用到),网络上也有工具提供汉字转拼音的功能,但各有优劣,一般转拼音后还会存在带声调的字母,可以用sql统一转换. DROP TABLE PINYIN; CREATE TABLE PINYIN(ID VARCHAR2(),B VARCHAR2(),C VARCHAR2(),D VARCHAR2(),E VARCHAR2()); --用金山词霸汉字转拼音工具先转有声调的拼音,拷贝到E列中 -…
if exists (select * from sysobjects where id = object_id(N'[fn_ChineseToSpell]') and xtype in (N'FN', N'IF', N'TF')) www.2cto.com drop function [fn_ChineseToSpell]GO/*创建取拼音首字母函数*/ create function [dbo].[fn_ChineseToSpell](@strChinese varchar(500)='')…
汉字首字母查询处理用户定义函数 CREATE FUNCTION f_GetPY1(@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'鏊' UNIO…
(1)------------------------------------------------------------------------------------------------------------------------------------------------------------------------- create function GetPY(@str varchar(500))returns varchar(500)asbegin declare @…
create function fun_getPY ( @str nvarchar(4000) ) returns nvarchar(4000) as begin declare @word nchar(1),@PY nvarchar(4000) set @PY='' while len(@str)>0 begin set @word=left(@str,1) --如果非汉字字符,返回原字符 set @PY=@PY+(case when unicode(@word) between 19968…
IF OBJECT_ID('Fn_GetQuanPin','Fn') IS NOT NULL DROP FUNCTION fn_GetQuanPin go )) ) as begin ),) declare @strlen int select @strlen=len(@str),@re='' begin ) select @re= CASE when @crs<'吖' COLLATE Chinese_PRC_CS_AS_KS_WS then @crs when @crs<='厑' COLLA…
var PinYin = {"a":"\u554a\u963f\u9515","ai":"\u57c3\u6328\u54ce\u5509\u54c0\u7691\u764c\u853c\u77ee\u827e\u788d\u7231\u9698\u8bf6\u6371\u55f3\u55cc\u5ad2\u7477\u66a7\u7839\u953f\u972d","an":"\u978d\u6…
SQL汉字转拼音函数-支持首字母.全拼 FROM :http://my.oschina.net/ind/blog/191659 作者不详 --方法一sqlserver汉字转拼音首字母 --调用方法 select dbo.procGetPY ('中國') Create FUNCTION dbo.procGetPY ( ) ) /* select dbo. procGetPYFirstLetter ('中國') */ ) --WITH ENCRYPTION AS BEGIN ),) SET @PY=…