sqlserver 快速生成汉字的首拼字母的函数(经典)
union all select 'Q',N'囕'
select top 1 PY
from
end
as
)
end)
else @word
SET ANSI_NULLS ON
union all select 'S',N'蜶'
begin
GO
union all select 'M',N'旀'
union all select 'P',N'曝'
SET QUOTED_IDENTIFIER ON
end
*/
USE [tempdb]
order by PY ASC
select dbo.[fun_getPY]('中国人') 首拼
/*
/****** Object: UserDefinedFunction [dbo].[fun_getPY] Script Date: 05/23/2012 18:03:45 ******/
union all select 'O',N'漚'
select 'A' as PY,N'驁' as word
union all select 'L',N'鱳'
while len(@str)>0
set @PY=''
复制代码 代码如下:
declare @word nchar(1),@PY nvarchar(4000)union all select 'R',N'鶸'
union all select 'G',N'腂'
ALTER function [dbo].[fun_getPY]
)
@str nvarchar(4000)
set @str=right(@str,len(@str)-1)
(
union all select 'T',N'籜'
获取汉字的首拼音
where word>=@word collate Chinese_PRC_CS_AS_KS_WS
set @PY=@PY+(case when unicode(@word) between 19968 and 19968+20901
union all select 'D',N'鵽'
union all select 'J',N'攈'
调用如下:
return upper(@PY)
) T
复制代码 代码如下:
union all select 'X',N'鑂'union all select 'N',N'桛'
then (
begin
union all select 'Y',N'韻'
set @word=left(@str,1)
如果是非汉字字符
GO
GO
union all select 'Z',N'咗'
union all select 'H',N'夻'
returns nvarchar(4000)
union all select 'W',N'鶩'
union all select 'F',N'鰒'
union all select 'K',N'穒'
--如果非汉字字符,返回原字符
(
union all select 'C',N'錯'
相关热词:
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/sql/mssql/1536.shtml
相关文章
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
SQL基本教程之行转列Pivo
时间:2021-01-20
-
region from hr.Employees union
时间:2021-01-20
-
有时候需要调整用户权限
时间:2021-01-19
-
(但使用 ORDER BY 子句并不
时间:2021-01-19
-
RAND()*10000)insert into Detail
时间:2021-01-19
-
OR 运算符:在两侧的查询
时间:2021-01-19
-
放假之前老大跟我提起了
时间:2021-01-19
-
数据库的运维计策剧本篇
时间:2021-01-19
热门文章
-
4.与聚合函数和 GROUP BY 子句有关的常见错
时间:2021-01-19
-
SQL Server安全(11/11):审核(Auditing)
时间:2021-01-09
-
sqlserver中查询横表变竖表的sql语句简析
时间:2020-12-08
-
SQL Server简单模式下误删除堆表记录恢复方
时间:2020-12-12
-
关于SQL Server查询语句的使用
时间:2020-12-13
-
MSSQL教程_mssql数据库教程_MSSQL基础教程_第
时间:2020-12-13
-
jdbc连接sql server数据库问题分析
时间:2020-12-10
-
详解SQL游标的用法
时间:2020-12-27
-
sql server 关于设置null的一些建议
时间:2020-12-28
-
mssql关于一个表格结构的另外一种显示(表
时间:2020-12-11
