SQL Server 计算汉字笔画函数
create function [dbo].[fun_getbh](@char nchar(2))
returns int
as
begin
return(
case when unicode(@char) between 19968 and 40869 then(
select top 1 id from(
select id=1,ch=N'亅'
union all select 2,N'阝'
union all select 3,N'马'
union all select 4,N'风'
union all select 5,N'龙'
union all select 6,N'齐'
union all select 7,N'龟'
union all select 8,N'齿'
union all select 9,N'鸩'
union all select 10,N'龀'
union all select 11,N'龛'
union all select 12,N'龂'
union all select 13,N'龆'
union all select 14,N'龈'
union all select 15,N'龊'
union all select 16,N'龍'
union all select 17,N'龠'
union all select 18,N'龎'
union all select 19,N'龐'
union all select 20,N'龑'
union all select 21,N'龡'
union all select 22,N'龢'
union all select 23,N'龝'
union all select 24,N'齹'
union all select 25,N'龣'
union all select 26,N'龥'
union all select 27,N'齈'
union all select 28,N'龞'
union all select 29,N'麷'
union all select 30,N'鸞'
union all select 31,N'麣'
union all select 32,N'龖'
union all select 33,N'龗'
union all select 35,N'齾'
union all select 36,N'齉'
union all select 39,N'靐'
union all select 64,N'龘'
)a where ch>=@char collate Chinese_PRC_Stroke_CS_AS_KS_WS
order by id ASC)
else 0 end)
end
--测试示例
select dbo.fun_getbh('张')
SQL Server 计算汉字笔画函数的更多相关文章
- sql server 2012 自定义聚合函数(MAX_O3_8HOUR_ND) 计算最大的臭氧8小时滑动平均值
采用c#开发dll,并添加到sql server 中. 具体代码,可以用visual studio的向导生成模板. using System; using System.Collections; us ...
- SQL Server 进制转换函数
一.背景 前段时间群里的朋友问了一个问题:“在查询时增加一个递增序列,如:0x00000001,即每一个都是36进位(0—9,A--Z),0x0000000Z后面将是0x00000010,生成一个像下 ...
- ylb:SQL Server中的时间函数
ylbtech-SQL Server:SQL Server-SQL Server中的时间函数 SQL Server中的时间函数. 1,SQL Server中的时间函数 返回顶部 1. 当前系统日期 ...
- SQL Server中的DATEPART函数的使用
下面文章来自:http://blog.csdn.net/hello_world_wusu/article/details/4632049 定义和用法 DATEPART() 函数用于返回日期/时间的单独 ...
- SQL Server中的CLR编程——用.NET为SQL Server编写存储过程和函数
原文:SQL Server中的CLR编程--用.NET为SQL Server编写存储过程和函数 很早就知道可以用.NET为SQL Server2005及以上版本编写存储过程.触发器和存储过程的,不过之 ...
- sql server 提取汉字/数字/字母的方法
sql server 提取汉字/数字/字母的方法 --提取数字 IF OBJECT_ID('DBO.GET_NUMBER2') IS NOT NULL DROP FUNCTION DBO.GET_NU ...
- 刷新SQL Server所有视图、函数、存储过程
刷新SQL Server所有视图.函数.存储过程 更多 sql 此脚本用于在删除或添加字段时刷新相关视图,并检查视图.函数.存储过程有效性. [SQL]代码 --视图.存储过程.函数名称 DE ...
- 刷新SQL Server所有视图、函数、存储过程 更多 sql 此脚本用于在删除或添加字段时刷新相关视图,并检查视图、函数、存储过程有效性。 [SQL]代码 --视图、存储过程、函数名称 DECLARE @NAME NVARCHAR(255); --局部游标 DECLARE @CUR CURSOR --自动修改未上状态为旷课 SET @CUR=CURSOR SCROLL DYNAMIC FO
刷新SQL Server所有视图.函数.存储过程 更多 sql 此脚本用于在删除或添加字段时刷新相关视图,并检查视图.函数.存储过程有效性. [SQL]代码 --视图.存储过程.函数名称 DE ...
- SQL Server ->> FIRST_VALUE和LAST_VALUE函数
两个都是SQL SERVER 2012引入的函数.用于返回在以分组和排序后取得最后一行的某个字段的值.很简单两个函数.ORDER BY字句是必须的,PARITION BY则是可选. 似乎没什么好说的. ...
随机推荐
- CUDA与OpenCL架构
CUDA与OpenCL架构 目录 CUDA与OpenCL架构 目录 1 GPU的体系结构 1.1 GPU简介 1.2 GPU与CPU的差异 2 CUDA架构 2.1 硬件架构 2.1.1 GPU困境 ...
- 非阻塞方式connect编程
参考博客: ①setsockopt()函数使用详解:http://blog.csdn.net/tody_guo/article/details/5972588 ②setsockopt :SO_LING ...
- mysql数据库索引原理及其常用引擎对比
索引原理 树数据结构及其算法简介 B+/-树: - 多路搜索树; - 时间复杂度O(logdN);h为节点出度,d为深度 红黑树: - 节点带有颜色的平衡二叉树 - 时间复杂度O(log2N);h节点 ...
- 软件的描述x
1)文档描述: 2)模型描述: 3)架构描述: 4)代码描述:
- 洛谷P3807 【模板】卢卡斯定理_组合数学模板
Code: #include<cstdio> using namespace std; typedef long long LL; const int maxn=1000000+2; LL ...
- mysql时区错误问题及命令行登录mysql方法
spring boot运行报错误信息“The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than ...
- C#学习 第九节
构造器 1.构造器(constructor)是类型的成员之一: 2.狭义的构造器是指“实例构造器”(instance constructor): 3.构造器的调用 student stu =new s ...
- 网站出现502 bad getway
最近项目之余,领导叫解决下系统网站经常出现502的问题,作为小头头的我,怎能不顶上. 流程开始走起,先查nginx,嗯,配置是大众的.是不是缓存溢出了呢.调节buffer的值 .貌似也没什么影响啊.5 ...
- python实现定时发送消息
#!/usr/bin/env python#-*- coding:utf-8 -*- @Author : wujf @Time:2018/8/21 15:59# 自动发送消息from threadin ...
- 何为JQuery对象?