zoukankan      html  css  js  c++  java
  • 通过时间相差的分钟数,得出加班半小时,1小时,1.5不时,2小时等..

    ALTER  function   [dbo].[GetHour](@dt1 datetime,@dt2 datetime)
      returns  varchar(30)
      as    
      begin  
       declare   @ch   as   varchar(30)  
       declare   @mins as int   
       select @mins =(SELECT datediff( MINUTE, @dt1 , @dt2))   
        if   @mins>= 30 and @mins< 60   
           begin  
            set @ch = '0.5 H'
           end  
        else if  @mins>= 60 and @mins<90   
            begin  
            set @ch = '1 H'
           end
        else if @mins>= 90 and @mins<120    
            begin  
            set @ch = '1.5 H'
           end    
        else if @mins>= 120 and @mins<150    
            begin  
            set @ch = '2 H'
           end       
        else if @mins>= 150 and @mins<180    
            begin  
            set @ch = '2.5 H'
           end 
        else if @mins>= 180 and @mins<210    
            begin  
            set @ch = '3 H'
           end 
       else if @mins>= 210 and @mins<240    
            begin  
            set @ch = '3.5 H'
           end
       else if @mins>= 240 and @mins<270    
            begin  
            set @ch = '4 H'
           end
       else if @mins>= 270 and @mins<300    
            begin  
            set @ch = '4.5 H'
           end
       else if @mins>= 300 and @mins<330    
            begin  
            set @ch = '5 H'
           end 
      else     
            begin  
            set @ch = @mins
           end 
       return @ch
      end
     
     

  • 相关阅读:
    常用 SQL 语句使用的总结
    LC 583. Delete Operation for Two Strings
    LC 873. Length of Longest Fibonacci Subsequence
    LC 869. Reordered Power of 2
    LC 900. RLE Iterator
    LC 974. Subarray Sums Divisible by K
    LC 973. K Closest Points to Origin
    LC 975. Odd Even Jump
    LC 901. Online Stock Span
    LC 722. Remove Comments
  • 原文地址:https://www.cnblogs.com/szlixin/p/4335433.html
Copyright © 2011-2022 走看看