Create function fun_getpy (@str nvarchar (4000)) returns nvarchar (4000) asBEGIN DECLARE @word nchar (1), @PY nvarchar (4000) Set@PY ="' whileLen (@str) >0beginSet@word =left (@str,1) --If non-kanji characters, return the original characterSet@[email protected]+ ( CaseWhen Unicode (@word) between19968and19968+20901Then (SelectTop1PY from ( Select 'A' asPy,n'驁' asWord Union allSelect 'B'N'Book'Union AllSelect 'C'N'wrong'Union AllSelect 'D'N'鵽'Union AllSelect 'E'N'樲'Union AllSelect 'F'N'鰒'Union AllSelect 'G'N'Hiker'Union AllSelect 'H'N'inceѕt'Union AllSelect 'J'N'攈'Union AllSelect 'K'N'穒'Union AllSelect 'L'N'鱳'Union AllSelect 'M'N'Temperature'Union AllSelect 'N'N'桛'Union AllSelect 'O'N'漚'Union AllSelect 'P'N'Exposure'Union AllSelect 'Q'N'囕'Union AllSelect 'R'N'鶸'Union AllSelect 'S'N'蜶'Union AllSelect 'T'N'籜'Union AllSelect 'W'N'clamoring'Union AllSelect 'X'N'鑂'Union AllSelect 'Y'N'Wan Leng'Union AllSelect 'Z'N' the') Twhereword>=@word collate Chinese_prc_cs_as_ks_ws ORDER by PY ASC) Else@word End)Set@str =right (@str, Len (@str)-1) Endreturn@PYend