sql_server自动生成拼音码

2022-03-27 00:46:22   文档大全网     [ 字体: ] [ 阅读: ]

#文档大全网# 导语】以下是®文档大全网的小编为您整理的《sql_server自动生成拼音码》,欢迎阅读!
自动生成,拼音,server,sql
sql server自动生成拼音首字母的函数

建立一个查询,执行下面的语句生成函数fn_GetPy --生成拼音首码

CREATE function getInputstr(@str nvarchar(4000)) returns nvarchar(4000) --WITH ENCRYPTION as

begin

declare @intLen int

declare @strRet nvarchar(4000) declare @temp nvarchar(100) set @intLen = len(@str) set @strRet = '' while @intLen > 0 begin

set @temp = ''

select @temp = case

when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then when substring(@str,@intLen,1) >= '' then else rtrim(ltrim(substring(@str,@intLen,1))) end

--对于汉字特殊字符,不生成拼音码

'Z' 'Y' 'X' 'W' 'T' 'S' 'R' 'Q' 'P' 'O' 'N' 'M' 'L' 'K' 'J' 'H' 'G' 'F' 'E' 'D' 'C' 'B' 'A'
if (ascii(@temp)>127) set @temp = '' --对于英文中小括号,不生成拼音码

if @temp = '(' or @temp = ')' set @temp = '' select @strRet = @temp + @strRet set @intLen = @intLen - 1 end

return lower(@strRet) end


本文来源:https://www.wddqxz.cn/9ee243dd71fe910ef12df8ef.html

相关推荐