zoukankan      html  css  js  c++  java
  • SQL生成日期列

    --生成一个日期范围,如2014.01、2014.02...
    --@type 自增部分类型 y,m,d,w
    --@@startDate 开始日期
    --@@endDate   结束日期
    create function CreateDateRange(@type char(1),@startDate date,@endDate date)
    returns @DateValueRange table(datevalue date)
    as
    begin
    
    declare @tempDate date=@startDate
    
    while @tempDate<@endDate
    begin
     select @tempDate= case @type when  'y' then dateadd(yy, 1, @tempDate) when  'm' then dateadd(mm, 1, @tempDate) when 'd' then dateadd(dd, 1, @tempDate) when  'w' then dateadd(ww, 1, @tempDate)end 
     insert into @DateValueRange(datevalue)select @tempDate
    end 
     return  
          
    end
    go
    select * from CreateDateRange('d',GETDATE(),GETDATE()+10)
  • 相关阅读:
    A
    N
    M
    L
    K
    J
    sass
    通过ps给透明通道的图片添加灰度(适用于需要兼容IE7,效果很好)
    CSS十一问——好奇心+刨根问底=CSSer
    清除浮动的7种方法
  • 原文地址:https://www.cnblogs.com/tlmbem/p/10693364.html
Copyright © 2011-2022 走看看