国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > SQL Server > 正文

一個sql server中用到的函數,用來取拼音

2024-08-31 00:48:02
字體:
來源:轉載
供稿:網友
create function f_getpy(@str nvarchar(4000))
returns nvarchar(4000)
as
begin
declare @strlen int,@re nvarchar(4000)
declare @t table(chr nchar(1) collate chinese_prc_ci_as,letter nchar(1))
insert into @t(chr,letter)
  select '吖','a' union all select '八','b' union all
  select '嚓','c' union all select '咑','d' union all
  select '妸','e' union all select '發','f' union all
  select '旮','g' union all select '鉿','h' union all
  select '丌','j' union all select '咔','k' union all
  select '垃','l' union all select '嘸','m' union all
  select '拏','n' union all select '噢','o' union all
  select '妑','p' union all select '七','q' union all
  select '呥','r' union all select '仨','s' union all
  select '他','t' union all select '屲','w' union all
  select '夕','x' union all select '丫','y' union all
  select '帀','z'
  select @strlen=len(@str),@re=''
  while @strlen>0
  begin
    select top 1 @[email protected],@[email protected]
      from @t a where chr<=substring(@str,@strlen,1)
      order by chr desc
    if @@rowcount=0
      select @re=substring(@str,@strlen,1)[email protected],@[email protected]
  end
  return(@re)
end
go
--調用
select * from alls where dbo.f_getpy(name)='cyml'
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 邛崃市| 安国市| 哈尔滨市| 庄浪县| 嘉义市| 青龙| 巴中市| 武邑县| 南投市| 普宁市| 星座| 兰考县| 库车县| 卓资县| 江川县| 库尔勒市| 同心县| 无棣县| 抚州市| 遵义市| 巴东县| 汨罗市| 花莲县| 吉隆县| 南丹县| 兰溪市| 伊通| 陵川县| 五华县| 黎城县| 资源县| 锦屏县| 沙雅县| 南充市| 中卫市| 七台河市| 肃宁县| 宝兴县| 沿河| 贵港市| 拉孜县|