基于Microsoft SQL Server 的标量值函数fun_GetPy,借鉴其他优秀的博主文章,此处贴出源码,以及使用方法 1.打开新建查询,贴如下代码,F5 /****** Object: UserDefinedFunction [dbo].[fun_GetPy] Script Date: 11/01/2019 11:07:35 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO )) ) AS BEGIN ) ) COLLA
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)='')
-- ============================================= -- 功能:汉字转换成拼音首字母 首字母查 -- ============================================= )='') ) as begin --定义变量 ), @ii int ),) --设置初始值 --开始循环取出没个字符 while @ii<@strlen begin ,,) if @chn>'z' ,@c = case chn when @chn then
从网络上收刮了一些,以备后用 create function fun_getPY(@str nvarchar()) returns nvarchar() as begin declare @word nchar(),@PY nvarchar() set @PY='' begin ) --如果非汉字字符,返回原字符 and + then ( PY from ( select 'A' as PY,N'驁' as word union all select 'B',N'簿' union all sel
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](@