zoukankan      html  css  js  c++  java
  • SQL Server 获取汉语拼音简码

    alter FUNCTION FB_GetChineseSpell
    (
        
    @Str   varchar(500)=''
    )
    RETURNS  varchar(500)
    as   
      
    begin   
        
    declare @strLen int
        
    declare @index int
        
    declare @VChControl char(2)
        
    DECLARE @VChSpell VARCHAR(30)
        
    declare @return varchar(500)
        
    set @return=''
        
    set @strlen=len(@str)
        
    set @index=1
        
    while @index<=@strlen
        
    begin
            
    select @VChControl=substring(@str,@index,1)
             
    IF @VChControl>'' AND @VChControl<'' 
                
    SELECT @VChSpell='A'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='B'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='C'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='D'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='E'
            
    ELSE IF @VChControl>='' AND @VChControl<=''
                
    SELECT @VChSpell='F'
            
    ELSE IF @VChControl>'' AND @VChControl<'' 
                
    SELECT @VChSpell='G'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='H'
            
    ELSE IF @VChControl>='' AND @VChControl<''
                
    SELECT @VChSpell='J'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='K'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='L'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='M'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='N'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='O'
            
    ELSE IF @VChControl>='' AND @VChControl<''
                
    SELECT @VChSpell='P'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='Q'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='R'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='S'
            
    ELSE IF @VChControl>='' AND @VChControl<''
                
    SELECT @VChSpell='T'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='W'
            
    ELSE IF @VChControl>='' AND @VChControl<''
                
    SELECT @VChSpell='X'
            
    ELSE IF @VChControl>='' AND @VChControl<'' 
                
    SELECT @VChSpell='Y'
            
    ELSE IF @VChControl>='' AND @VChControl<='' 
                
    SELECT @VChSpell='Z'
            
    ELSE
                
    SELECT @VChSpell=@VChControl

            
    SELECT @return=@return + RTRIM(UPPER(@VChSpell))
            
    set @index=@index+1
        
    end
      
    return(@return)   
      
    end
  • 相关阅读:
    Sql server数据库设计 7
    day08作业
    day01作业
    day07作业.
    day05作业
    day04作业
    day02作业
    初学Java的一些注意事项
    day07作业
    Week03面向对象入门
  • 原文地址:https://www.cnblogs.com/cpine/p/2123969.html
Copyright © 2011-2022 走看看