SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO )) ) as begin ),) set @PY='' begin ) --如果非汉字字符,返回原字符 PY from ( select 'A' as PY,N'驁' as word union all select 'B',N'簿' union all select 'C',N'錯' union all select 'D',N'鵽' union all select 'E',N'樲' unio
http://blog.csdn.net/zhanglong_longlong/article/details/46772571 --可支持大字符集20000个汉字! create function f_ch2py(@chn nchar(1)) returns char(1) as begin declare @n int declare @c char(1) set @n = 63 select @n = @n +1, @c = case chn when @chn then char(@n)
使用下方的函数.. 忘了从哪抄的了..留存一份 如果只要首字母..建议将数据 Left(tableFiled,1) 后传入函数 如果字段是空或者null, 不会报错..返回空 方法体: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE FUNCTION [dbo].[F_SYS_getPY] ( ) ) ) AS BEGIN ),) SET @PY='' BEGIN ) PY FROM ( SELECT 'A' AS PY,N'驁'