• 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
  • 相关阅读:
    快考试了
    16号了
    终于找到网吧了,写写今天
    又打了一天的篮球
    (转载)Andoid2.X各字段意义
    (转载)AndroidMatrixCursor
    (转载)非常好 必须要顶
    (转载)Android Cursor之MergeCursor
    七天开发安卓软件(二)
    “Visual Studio.net已检测到指定的Web服务器运行的不是Asp.net1.1版。您将无法运行Asp.net Web应用程序或服务”问题的解决方法
  • 原文地址:https://www.cnblogs.com/zjbky/p/5450738.html
Copyright © 2020-2023  润新知