/ * - Get the first letters of the Chinese character string - * / if EXISTS (Select * from dbo.sysObjects where id = Object_id (n '[dbo]. [Fgetpy]') and xtype in (n'fn ', n 'IF', N'TF ')) Drop Function [DBO]. [Fgetpy] Go - Create Pinyin Function Create Function FGETPY (@str varchar (500) =') Returns Varchar (500) asbegindeclare @strlen Int, @Return varchar (500), @ ii intDeclare @n int, @ c char (1), @ chn nchar (1) select @ strlen = len (@str), @ Return = ', @ ii = 0set @ ii = 0WHILE @ii <@strlenbeginselect @ ii = @ ii 1, @ n = 63, @ chn = Substring (@ Str, @ II, 1) if @n> 'z'select @n = @n 1, @ c = Case chn by @chn dam (@n) else @c endfrom (select top 27 * from (select chn = '' union all select 'eight' 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 'Wash' Union All Select '呒' Union All Select 'Nion All Select' 噢 'Union All Select' 妑 'Union All Select' 7 'Union All Select' 呥 'Union All Select' 仨 'Union All Select' He 'union all succ' 屲 '--NO 'U'Union All Select' 屲 '--NO' V'UNION All Select '屲' Union All Select 'XL' Union All Select '丫' Union All Select '帀' Union All Select @chn) AS AIRDER BY CHN collate Chinese_prc_ci_as) AS BELSE SET @ c = 'a'set @ return = @ Return @ CENDRETURN (@