zoukankan      html  css  js  c++  java
  • sql奇进偶舍函数

     create   function   sslr(@num   numeric(20,10),@i   int) 
    --@i保留的小数位 
    --@num传入的数据 
    returns   varchar(20) 
    as 
    begin 
    declare   @numtemp   numeric(20,10),@result   varchar(20) 
    set   @numtemp=abs(@num)*power(10,@i+1) 
    select   @numtemp=(case   when   floor(@numtemp)-floor(@numtemp/10)*10=5 
                                                then   (case   when   @numtemp-floor(@numtemp)=0 
                                                                      then   (case   when   cast(floor(@numtemp/10)   as   int)%2=0 
                                                                                            then   floor(@numtemp/10)/power(10,@i) 
                                                                                            else   round(@numtemp/power(10,@i+1),@i) 
                                                                                              end) 
                                                                      else   round(@numtemp/power(10,@i+1),@i) 
                                                                      end) 
                                                  else   round(@numtemp/power(10,@i+1),@i) 
                                                  end) 
    set   @result=(case   when   @num> 0   then   str(@numtemp,20,@i)   else   str(0-@numtemp,20,@i)   end) 
    return   @result 
    end
  • 相关阅读:
    KMP算法理解
    vimium 快捷键
    如何选择优化器 optimizer
    用python实现归并排序
    用python实现快速排序
    用python实现插入排序
    使用PyCharm进行远程开发和调试
    查看python iterpreter的路径和当前选择的解释器
    grid search
    一些书单
  • 原文地址:https://www.cnblogs.com/zjbky/p/5450738.html
Copyright © 2011-2022 走看看