/**//*--获得汉字字符串的首字母--*/ -- 取拼音首字母函数 create function GetPinYinFromWord(@Str varchar(500)='') returns varchar(500) as begin declare @strlen int,@return varchar(500),@ii int declare @n int,@c char(1),@chn nchar(1) select @strlen=len(@str),@return='',@ii=0 set @ii=0 while @ii<@strlen begin select @ii=@ii+1,@n=63,@chn=substring(@str,@ii,1) if @chn>'z' select @n = @n +1 ,@c = case chn when @chn then char(@n) else @c end from( select top 27 * from ( select chn = '吖' union all select '把' union all select '擦' union all select '大' union all select '饿' union all select '发' union all select '噶' union all select '哈' union all select '几' --because have no 'i' union all select '几' union all select '卡' union all select '拉' union all select '吗' union all select '嗯' union all select '哦' union all select '怕' union all select '瑁' union all select '染' union all select '撒' union all select '他' union all select '挖' --no 'u' union all select '挖' --no 'v' union all select '挖' union all select '西' union all select '呀' union all select '杂' union all select @chn) as a order by chn COLLATE Chinese_PRC_CI_AS ) as b else set @c='a' set @return=@return+@c end return(@return) end --测试 --Select dbo.GetPinYinFromWord('黎摄文') --结果 --LSW