日期:2014-05-17 浏览次数:21167 次
CREATE FUNCTION [dbo].[fun_getPY]
(
@str NVARCHAR(4000),
@len int
)
RETURNS NVARCHAR(4000)
AS
BEGIN
DECLARE @word NCHAR(1),@PY NVARCHAR(4000)
SET @PY=''
WHILE len(@str)>0
BEGIN
SET @word=left(@str,1)
SET @PY=@PY+(CASE WHEN unicode(@word) BETWEEN 19968 AND 19968+20901
THEN (SELECT TOP 1 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'樲'
UNION ALL SELECT 'F',N'鰒'
UNION ALL SELECT 'G',N'腂'
UNION ALL SELECT 'H',N'夻'
UNION ALL SELECT 'J',N'攈'
UNION ALL SELECT 'K',N'穒'
UNION ALL SELECT 'L',N'鱳'
UNION ALL SELECT 'M',N'旀'
UNION ALL SELECT 'N',N'桛'