SQL函数取汉字拼音首字母
CREATE function f_GetFirstPy(@str varchar(50)='')
returns char(1)
as
begin
declare @n int, @c char(1), @chn nchar(1)
select @n=63, @chn=substring(@str,1,1)
if @chn > 'z'
if( @chn < '八' ) set @c = 'A'
else if ( @chn < '嚓' ) set @c = 'B'
else if ( @chn < '咑' ) set @c = 'C'
else if ( @chn < '妸' ) set @c = 'D'
else if ( @chn < '发' ) set @c = 'E'
else if ( @chn < '旮' ) set @c = 'F'
else if ( @chn < '铪' ) set @c = 'G'
else if ( @chn < '丌' ) set @c = 'H'
else if ( @chn < '丌' ) set @c = 'I'
else if ( @chn < '咔' ) set @c = 'J'
else if ( @chn < '垃' ) set @c = 'K'
else if ( @chn < '嘸' ) set @c = 'L'
else if ( @chn < '拏' ) set @c = 'M'
else if ( @chn < '噢' ) set @c = 'N'
else if ( @chn < '妑' ) set @c = 'O'
else if ( @chn < '七' ) set @c = 'P'
else if ( @chn < '呥' ) set @c = 'Q'
else if ( @chn < '仨' ) set @c = 'R'
else if ( @chn < '他' ) set @c = 'S'
else if ( @chn < '屲' ) set @c = 'T'
else if ( @chn < '屲' ) set @c = 'U'
else if ( @chn < '屲' ) set @c = 'V'
else if ( @chn < '夕' ) set @c = 'W'
else if ( @chn < '丫' ) set @c = 'X'
else if ( @chn < '帀' ) set @c = 'Y'
else set @c = 'Z'
else if @chn <= 'z' and @chn >= 'a'
set @c = upper(@chn)
else if @chn <= 'Z' and @chn >= 'A'
set @c = @chn
else
set @c = ''
return (@c)
end
SQL函数取汉字拼音首字母的更多相关文章
- sql语句按照汉字拼音首字母排序
oracle : 在oracle9i中新增了按照拼音.部首.笔画排序功能.设置NLS_SORT值SCHINESE_RADICAL_M 按照部首(第一顺序).笔划(第二顺序)排序SCHINESE_STR ...
- sql语句-按照汉字拼音首字母排序
在oracle9i中新增了按照拼音.部首.笔画排序功能.设置NLS_SORT值 SCHINESE_RADICAL_M 按照部首(第一顺序).笔划(第二顺序)排序SCHINESE_STROKE_M 按照 ...
- sql实现取汉字大写首字母
)) ) AS BEGIN DECLARE @py TABLE( ch ), hz1 ) COLLATE Chinese_PRC_CS_AS_KS_WS, hz2 ) COLLATE Chinese_ ...
- MySQL通过函数获取字符串汉字拼音首字母大写字符串
DELIMITER $$ DROP FUNCTION IF EXISTS `Fun_GetPY`$$ CREATE FUNCTION `HIS`.`Fun_GetPY` (in_string VARC ...
- 取字符串拼音首字母(js)
//取字符串拼音首字母 function makePy(str) { if (typeof(str) != "string") throw new Error(-1, " ...
- AutoCompleteTextView输入汉字拼音首字母实现过滤提示(支持多音字,Filterable的使用)
AutoCompleteTextView具有输入提示的功能,但是它的这种提示不适合对股票列表的过滤,如果你玩过股票软件,就会知道只要输入股票名称的首字母或股票代码就会出现符合匹配的股票,这种过滤怎么实 ...
- C# 获取汉字拼音首字母
最近悟出来一个道理,在这儿分享给大家:学历代表你的过去,能力代表你的现在,学习代表你的将来. 十年河东十年河西,莫欺少年穷 学无止境,精益求精 本节探讨C#获取汉字拼音首字母的方法: 代码类东西, ...
- C# 获取汉字拼音首字母/全拼
最近悟出来一个道理,在这儿分享给大家:学历代表你的过去,能力代表你的现在,学习代表你的将来. 十年河东十年河西,莫欺少年穷 学无止境,精益求精 本节探讨C#获取汉字拼音首字母的方法: 代码类东西, ...
- (转载)C#提取汉字拼音首字母的方法
今天突然要用到提取汉字拼音首字母的功能,去网上找了找,发现没有几个好用的,决定自己写一个,效果还不错,发出来大家一起研究下,分享给大家!直接入主题: 1.首先对编码进行定义 #region 编码定义 ...
随机推荐
- NJCTF (easycrack)
安装app查看.一个输入框,输入随便输入显示Try again. 放入JEB反编译. 关于输入框监听是第一次见,具体可以看看这个博客https://www.jianshu.com/p/f976c677 ...
- Python-数据库连表查询、子查询
连表查询 [实例]通过例子来熟悉连表查询的概念 # 第一步:建表 # 建立英雄职业分类表格 create table classification( id int, name varchar(20) ...
- webgoat8百度云下载链接
网络不好的很难下载,网上也没什么好用的下载链接,我就上传了百度网盘,有需要的兄弟自己下. 链接:https://pan.baidu.com/s/1plTxkZUhSZm9vA5GGzYmMQ 提取码: ...
- pypy3.6的下载地址和安装第三方依赖
1.不同版本的下载链接 建议使用此链接:https://bitbucket.org/pypy/pypy/downloads/ 官网的:http://doc.pypy.org/en/latest/rel ...
- 【Linux开发】linux设备驱动归纳总结(一):内核的相关基础概念
linux设备驱动归纳总结(一):内核的相关基础概念 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ...
- mybatis批量更新update-设置多个字段值allowMultiQueries=true
mybatis由于简单易用性得到大家的认可和使用 但是在批量更新操作中,网上介绍的貌似不全,正好今天做个记录,大家一起进步 在实际项目开发过程中,常有这样的需求:根据ids更新表的某一个字段值,这时的 ...
- PTA(Basic Level)1026.程序运行时间
要获得一个 C 语言程序的运行时间,常用的方法是调用头文件 time.h,其中提供了 clock() 函数,可以捕捉从程序开始运行到 clock() 被调用时所耗费的时间.这个时间单位是 clock ...
- HDU1305 Immediate Decodability (字典树
Immediate Decodability An encoding of a set of symbols is said to be immediately decodable if no cod ...
- ARM Cortex-M 系列 MCU 错误追踪库 心得
一. 感谢CmBacktrace开源项目,git项目网站:https://github.com/armink/CmBacktrace 二. 移植CmBacktrace 2.1 准备好CmBacktra ...
- JS正则之---HTML版
话不多说 上代码 <html><head> <meta http-equiv="Content-Type" content="text/h ...