--
获取本周时间段值
SELECT DATEADD (WK, DATEDIFF (WK, 0 , GETDATE ()), - 1 )
SELECT DATEADD (WK, DATEDIFF (WK, 0 , GETDATE ()), 6 )
-- 获取本月时间段值
SELECT DATEADD (MM, DATEDIFF (MM, 0 , GETDATE ()), 0 )
SELECT DATEADD (MS, - 3 , DATEADD (MM, DATEDIFF (M, 0 , GETDATE ()) + 1 , 0 ))
-- 获取本年时间段值
SELECT DATEADD (YY, DATEDIFF (YY, 0 , GETDATE ()), 0 )
SELECT DATEADD (MS, - 3 , DATEADD (YY, DATEDIFF (YY, 0 , GETDATE ()) + 1 , 0 ))
SELECT DATEADD (WK, DATEDIFF (WK, 0 , GETDATE ()), - 1 )
SELECT DATEADD (WK, DATEDIFF (WK, 0 , GETDATE ()), 6 )
-- 获取本月时间段值
SELECT DATEADD (MM, DATEDIFF (MM, 0 , GETDATE ()), 0 )
SELECT DATEADD (MS, - 3 , DATEADD (MM, DATEDIFF (M, 0 , GETDATE ()) + 1 , 0 ))
-- 获取本年时间段值
SELECT DATEADD (YY, DATEDIFF (YY, 0 , GETDATE ()), 0 )
SELECT DATEADD (MS, - 3 , DATEADD (YY, DATEDIFF (YY, 0 , GETDATE ()) + 1 , 0 ))