--本月月初
select dateadd(mm,datediff(mm,0,getdate()),0)
--本月月末
select DATEADD(DD,-1,DATEADD(MONTH,1+DATEDIFF(MONTH,0,GETDATE()),0))
--设置每周的第一天为星期一
SET DateFirst 1
declare @cur_week1 varchar(10)
--本周第一天
select @cur_week1=DATEADD(DAY,1-DATEPART(WEEKDAY,getdate()),getdate())
--取近四周(自然周)每周的起始日期
--往前推第一周的第一天,最后一天
select DATEADD(WEEK,-1,@cur_week1)
select DATEADD(dd,6,DATEADD(WEEK,-1,@cur_week1))
--往前推第两周的第一天,最后一天
select DATEADD(week,-2,@cur_week1)
select DATEADD(dd,6,DATEADD(WEEK,-2,@cur_week1))
--往前推第三周的第一天,最后一天
select DATEADD(week,-3,@cur_week1)
select DATEADD(dd,6,DATEADD(WEEK,-3,@cur_week1))
--往前推第四周的第一天,最后一天
select DATEADD(week,-4,@cur_week1)
select DATEADD(dd,6,DATEADD(WEEK,-4,@cur_week1))