MS SQL server 自定义函数:获取汉字拼音首字母(音序)
转来的,很好用,要谢谢作者的
Create function [dbo].[fun_getPY]
(
@str nvarchar(4000)
)
returns nvarchar(4000)
as
begin
declare @word nchar(1),@PY nvarchar(4000)
set @PY=”
while len(@str)>0
begin
set @word=left(@str,1)
–如果非汉字字符,返回[……]