代码如下: –函数 CREATE function fn_GetPy(@str nvarchar(4000)) returns nvarchar(4000) –WITH ENCRYPTION as begin declare @intLenint declare @strRetnvarchar(4000) declare @temp nvarchar(100) set @intLen = len(@str) set @strRet = ” while @intLen > 0 begin set @temp = ” select @temp = case when substring(@str,