• 创建取汉字首字母函数


    create function [dbo].[f_getpy_V4] 

        @col varchar(1000) 

    returns varchar(1000) 
        begin 
            declare @cyc int,@len int,@sql varchar(1000),@char varbinary(20) 
            select @cyc = 1,@len = len(@col),@sql = '' 
            while @cyc <= @len  
                begin   
                    select @char = cast(substring(@col, @cyc, 1) as varbinary) 
                    if @char>=0XB0A1 and @char<=0XB0C4      set @sql=@sql+'A' 
                    else if @char>=0XB0C5 and @char<=0XB2C0 set @sql=@sql+'B' 
                    else if @char>=0XB2C1 and @char<=0XB4ED set @sql=@sql+'C' 
                    else if @char>=0XB4EE and @char<=0XB6E9 set @sql=@sql+'D' 
                    else if @char>=0XB6EA and @char<=0XB7A1 set @sql=@sql+'E' 
                    else if @char>=0XB7A2 and @char<=0XB8C0 set @sql=@sql+'F' 
                    else if @char>=0XB8C1 and @char<=0XB9FD set @sql=@sql+'G' 
                    else if @char>=0XB9FE and @char<=0XBBF6 set @sql=@sql+'H' 
                    else if @char>=0XBBF7 and @char<=0XBFA5 set @sql=@sql+'J' 
                    else if @char>=0XBFA6 and @char<=0XC0AB set @sql=@sql+'K' 
                    else if @char>=0XC0AC and @char<=0XC2E7 set @sql=@sql+'L' 
                    else if @char>=0XC2E8 and @char<=0XC4C2 set @sql=@sql+'M' 
                    else if @char>=0XC4C3 and @char<=0XC5B5 set @sql=@sql+'N' 
                    else if @char>=0XC5B6 and @char<=0XC5BD set @sql=@sql+'O' 
                    else if @char>=0XC5BE and @char<=0XC6D9 set @sql=@sql+'P' 
                    else if @char>=0XC6DA and @char<=0XC8BA set @sql=@sql+'Q' 
                    else if @char>=0XC8BB and @char<=0XC8F5 set @sql=@sql+'R' 
                    else if @char>=0XC8F6 and @char<=0XCBF9 set @sql=@sql+'S' 
                    else if @char>=0XCBFA and @char<=0XCDD9 set @sql=@sql+'T' 
                    else if @char>=0XCDDA and @char<=0XCEF3 set @sql=@sql+'W' 
                    else if @char>=0XCEF4 and @char<=0XD1B8 set @sql=@sql+'X' 
                    else if @char>=0XD1B9 and @char<=0XD4D0 set @sql=@sql+'Y' 
                    else if @char>=0XD4D1 and @char<=0XD7F9 set @sql=@sql+'Z' 
                    set @cyc = @cyc + 1  
                end 
            return @sql 
        end 
    go 

  • 相关阅读:
    「笔记」高斯消元
    函数库
    数学公式杂记
    CF1290E Cartesian Tree
    洛谷 P4027 [NOI2007] 货币兑换
    审计ThinkCMF框架任意内容包含漏洞与复现
    PHP代码审计笔记(基础篇)--命令执行漏洞
    某校园缴费平台通用0day偶然发现之路
    【转】教育src挖掘经验
    近期学习文章的整理(超级干货总结分享)
  • 原文地址:https://www.cnblogs.com/zhycyq/p/3867232.html
Copyright © 2020-2023  润新知