--创建取拼音函数
create function fGetPy(@Str varchar(500)='')
returns varchar(500)
as
begin
    declare @strlen int,@return varchar(500),@ii int
    declare @n int,@c char(1),@chn nchar(1)
    select @strlen=len(@str),@return='',@ii=0   
    set @ii=0
    while @ii<@strlen
    begin
        select @ii=@ii+1,@n=63,@chn=substring(@str,@ii,1)
        if @chn>'z'
        select @n = @n +1,@c = case chn when @chn then char(@n) else @c end
        from(
            select top 27 * from (
                select chn = '吖'
                union all select '八'
                union all select '嚓'
                union all select '咑'
                union all select '妸'
                union all select '发'
                union all select '旮'
                union all select '铪'
                union all select '丌'
                --because have no 'i'
                union all select '丌'
                union all select '咔'
                union all select '垃'
                union all select '嘸'
                union all select '拏'
                union all select '噢'
                union all select '妑'
                union all select '七'
                union all select '呥'
                union all select '仨'
                union all select '他'
                union all select '屲' --no 'u'
                union all select '屲' --no 'v'
                union all select '屲'
                union all select '夕'
                union all select '丫'
                union all select '帀'
                union all select @chn
            ) as a
            order by chn COLLATE Chinese_PRC_CI_AS
        ) as b
    else set @c='a'
        set @return=@return+@c
    end
    return(@return)
end

go
--测试
select dbo.fgetpy('魏啊光') as 姓名拼音,dbo.fgetpy('ab中c国人') as 中国人
select dbo.fgetpy('刘子良') as 姓名拼音,dbo.fgetpy('ab中c国人') as 中国人
select dbo.fgetpy('吴过') as 姓名拼音,dbo.fgetpy('ab中c国人') as 中国人
select dbo.fgetpy('东北') as 姓名拼音,dbo.fgetpy('ab中c国人') as 中国人

--删除拼音函数
drop function fgetpy

SQL 中国人--ZGR相关推荐

  1. MySQL自定义中文转拼音函数

    fristPinyin : 此函数是将一个中文字符串的第一个汉字转成拼音字母 (例如:"中国人"->Z) CREATE FUNCTION `fristPinyin`(P_NA ...

  2. MySQL 汉字转拼音

    一 . fristPinyin : 此函数是将一个中文字符串的第一个汉字转成拼音字母 (例如:"中国人"->Z) CREATE FUNCTION `fristPinyin`( ...

  3. centos mysql lujin_MySQL中文转换成拼音的函数[zt]

    注:如果创建函数出错,试试这个 set global log_bin_trust_function_creators=TRUE; 代码如下 -- 创建汉字拼音对照临时表 CREATE TABLE IF ...

  4. mysql汉字转拼音首字母_MySQL中文汉字转拼音的自定义函数和使用实例(首字的首字母)...

    fristPinyin : 此函数是将一个中文字符串的第一个汉字转成拼音字母 (例如:"中国人"->Z) CREATE FUNCTION `fristPinyin`(P_NA ...

  5. mysql 汉字转成拼音

    一.创建汉字拼音对照临时表 CREATE TABLE IF NOT EXISTS t_base_pinyin ( pin_yin_ varchar(255) CHARACTER SET utf8 NO ...

  6. 中文汉字编码技术的探索、突破与拓展

    希人人来支持.和关注汉语汉字!合力宏扬现今已经处于互联弱势,同全球某一些大语种一样,出现 了相当大的虚拟空间生存危机的,世界上最大语种的,中华民族拥有数千年历史的---汉语汉文汉字! 中文汉字编码技术 ...

  7. java 必备面试必备

    1.JDK 和 JRE 有什么区别? JDK(Java Development Kit),Java开发工具包 JRE(Java Runtime Environment),Java运行环境 JDK中包含 ...

  8. 这个是可以将得到速查编码的存储过程 如 中国人 可以得到 ZGR

    这个是可以将得到速查编码的存储过程 如 中国人 可以得到 ZGR SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO ALTER   proc LOG_F ...

  9. Oracle SQL高级编程——分析函数(窗口函数)全面讲解

    Oracle SQL高级编程--分析函数(窗口函数)全面讲解 注:本文来源于:<Oracle SQL高级编程--分析函数(窗口函数)全面讲解> 概述 分析函数是以一定的方法在一个与当前行相 ...

最新文章

  1. 梅宏院士:软件定义的未来——万物皆可互联,一切均可编程 | CNCC 2017
  2. Android PorterDuff.Mode
  3. 需求、需求工程与需求工程师 — 1.定义、作用
  4. Github | 标星3W+ ! Face Recognition世界上最简洁的人脸识别库!
  5. Codeigniter夸应用调用model
  6. k8s pod里访问不到外部ip_安全公告:影响所有K8s版本的设计缺陷
  7. MyEclipse安装插件的几种方法
  8. web.config学习资料
  9. python打包的exe反编译_将python打包的.exe文件还原成.py,针对Pyinstaller的exe反编译-exe文件...
  10. WinRunner的工作流程
  11. matlab中的封装引脚,lm5117封装引脚图及功能
  12. 【论文阅读】强化学习-Transfer and Multitask RL专题8篇
  13. CFD软件如何选择?STAR CCM+ VS ANSYS Fluent
  14. android 经验进度条,android ProgressBar(进度条)
  15. android软件多版本共存,1. android studio 多版本共存(2.2 and 3.3)
  16. 计算机没有进程管理器,win10系统任务管理器中没有进程的处理办法
  17. MySQL原理与实践(五):数据库的锁机制
  18. WPS计算机一级考试知识点,计算机一级考试WPS练习题及答案
  19. 战'疫'逆战学习总结分享
  20. 360 新推出的搜索会成功吗?

热门文章

  1. Django之django-dynamic-preferences
  2. 推荐系统(十五)多任务学习:谷歌MMoE(Multi-gate Mixture-of-Experts )
  3. 京东活动+自动运行脚本+签到2021.05.26更新
  4. kube-proxy模式之iptables
  5. 如何让手机扫二维码就能阅读PDF
  6. springMVC-后端控制器
  7. 旧作 一剪梅•秋夜
  8. Coursera Python学习笔记(二)数据结构
  9. python qqplot 检验正态分布
  10. agc001E BBQ Hard