1. 程式人生 > >sqlserver 獲取漢字拼音首字母

sqlserver 獲取漢字拼音首字母

create function [dbo].[fun_getPY](@str nvarchar(4000)) returns nvarchar(4000) as begin declare @word nvarchar(1),@PY nvarchar(4000) set @PY='' set @str = ltrim(rtrim(@str)) while len(@str)>0 begin set @word=left(@str,1) set @[email protected]+ltrim((case when unicode(@word) between 19968 and 19968
+20901 then (select top 1 PY from ( select 'A' as PY,N'驁' as word union all select 'B',N'簿' union all select 'C',N'錯' union all select 'D',N'鵽' union all select 'E',N'樲' union all select 'F',N'鰒' union all select 'G',N'腂' union all select 'H',N'夻' union all select 'J',N'攈' union all select 'K'
,N'穒' union all select 'L',N'鱳' union all select 'M',N'旀' union all select 'N',N'桛' union all select 'O',N'漚' union all select 'P',N'曝' union all select 'Q',N'囕' union all select 'R',N'鶸' union all select 'S',N'蜶' union all select 'T',N'籜' union all select 'W',N'鶩' union all select 'X',N'鑂'
union all select 'Y',N'韻' union all select 'Z',N'咗' ) T where word>[email protected] collate Chinese_PRC_CS_AS_KS_WS order by PY ASC) when unicode(@word) between 8544 and 8552 --希臘字母1-9 then nchar(unicode(@word)-8495) when unicode(@word) = 8553 --希臘字母10 then '0' when unicode(@word) between 48 and 57 --數字0-9 then @word when unicode(@word) between 65296 and 65305 --全形數字0-9 then nchar(unicode(@word)-65248) when unicode(upper(@word)) between 65 and 90 --字母a-z和A-Z then upper(@word) when unicode(upper(@word)) between 65313 and 65338 --全形字母a-z和A-Z then nchar(unicode(upper(@word))-65248) else '' end)) --如果非漢字字元或非字母、數字、希臘字母、全形字母、全形數字,返回空字元 --set @str=right(@str,len(@str)-1) set @str = substring(@str,2,len(@str)-1) end return @PY end

相關推薦

sqlserver 獲取漢字拼音字母

create function [dbo].[fun_getPY](@str nvarchar(4000)) returns nvarchar(4000) as begin declare @word nvarchar(1),@PY nvarchar(4000) set @PY='' set @st

php獲取漢字拼音字母的方法

emp tool iconv ace utf-8 comment 進行 adding padding 現實中我們經常看到這樣的說明,排名不分先後,按姓名首字母進行排序。這是中國人大多數使用的排序方法。那麽在php程序中該如何操作呢? 下面就分享一下在php程序中獲取漢字

mysql獲取漢字拼音字母

DELIMITER $$ USE `test`$$ DROP FUNCTION IF EXISTS `getPY`$$ CREATE DEFINER=`root`@`%` FUNCTION `getPY`(in_string VARCHAR(255)) RETURNS VARCHAR(255)

在Excel中如何獲取漢字拼音字母?

轉自:https://jingyan.baidu.com/article/0a52e3f43c3f6abf63ed7259.html百度經驗 在Excel中如何獲取漢字拼音首字母?|      在工作中,為了方便查詢、排序或者編碼,需要生成漢字內容

獲取漢字拼音字母類封裝

1、程式碼如下: 1 <?php 2 /** 3 * @file Pinyin.php 4 * @author whx https://www.cnblogs.com/whx-blogs/ 5 * @date 2018/12/03 18:32:18

VC/MFC 獲取漢字拼音字母(unicode編碼)

CString GetFirstLetter(LPCTSTR strName) { static int li_SecPosValue[] = { 1601, 1637, 1833, 2078, 2274, 2302, 2433,

delphi獲取漢字拼音字母〖各版本通用〗

因為DELPHI 2009開始支援UNICODE,所以如果使用DELPHI7需要用記事本,批量替換AnsiString為string,AnsiChar為char,就可以完美支援DELPHI 2009以下版本,現在附上的程式碼是預設支援UNICODE的,DELPHI XE4環

JAVA獲取漢字拼音字母

ecp ascii碼 else chart || versions odin osc 支持 package com.common.util;import java.io.UnsupportedEncodingException; /** * 取得給定漢字串的首字母串,即

漢字拼音字母的方法

nts cti res character con andro 字節 ext creat 近期在做一個按拼音首字母排序的ListView須要取漢字拼音首字母,Deomo下載地址:http://download.csdn.net/detail/u014649598/8

JS獲取中文拼音字母,並通過拼音字母快速查詢頁面內的中文內容

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

根據漢字拼音字母排序

                Comparator<Object> com=Collator.getInstance(java.util.Locale.CHINA);String[] newArray={"

sqlserver漢字字母的函式

Create  function fun_getPY  (     @str nvarchar(4000)  ) returns nvarchar(4000) as begin   declare @word nchar(1),@PY nvarchar(4000)   s

(轉)C# 獲取漢字拼音字母和全拼(含原始碼)[A]

  https://blog.csdn.net/younghaiqing/article/details/62417269   C# 獲取漢字的拼音首字母 一種是把所有中文字元集合起來組成一個對照表;另一種是依照漢字在Unicode編碼表中的排序來確定拼音的首字母

MySQL獲取漢字拼音字母

--獲取漢字拼音首字母的函式其一 DROP FUNCTION IF EXISTS `GET_FIRST_PINYIN_CHAR`; DELIMITER ;; CREATE FUNCTION `GET_F

Java獲取獲取漢字拼音字母程式碼

1、定義一個Bean: public class PinyinCode {  private String pinyin;  private int code;    public PinyinCode(String py, int cd) {   pinyin = py;

在vc中實現獲取漢字拼音字母

最近打算做一個基於字串首字元(漢字取拼音的首字母)進行查詢的電話簿WEB專案,由於Web本身並不支援漢字的編碼程式設計,因此需要求助於平臺開發工具。  Google上搜到一種實現方法,是用C++實現的。以下是原始碼:  void GetFirstLetter(CString

根據漢字獲取拼音字母(轉)

<mce:script  language="vbscript"><!--   function vbChr(c)    vbChr = chr(c)    end function   function vbAsc(n)    vbAsc = asc(n)    end f

簡單測試--C#實現中文漢字拼音字母

esp chart htm foreach ext ads linq 類庫 play 第一種: 這個是自己寫的比較簡單的實現方法,要做漢字轉拼音首字母,首先應該有一個存儲首字母的數組,然後將要轉拼音碼的漢字與每個首字母開頭的第一個漢字即“最小”的漢字作比較,這裏的最小指的是

PHP獲取中文字符拼音字母

toupper value date 排序 cnblogs log gb2 需求 ram 在項目中遇到需要把遊戲進行字母排序,於是百度到一個格式化的首字母的方法。 /** * @name php獲取中文字符拼音首字母 * @param $str

oracle漢字拼音(獲得全拼/拼音字母/拼音截取等)

sub 截取 需要 sel 內容 zip bsp .com 整理 oracle漢字轉拼音(獲得全拼/拼音首字母/拼音截取等) 效果如下: Oracle 字符集 GBK 沒有問題 , UTF -8 需要修改一下Sql代碼 --oracle漢字轉拼音 PACKAGE --1