标签:sp bs ad sql nbsp c select date qq
SELECT DATEADD(wk, DATEDIFF(wk,0,getdate()), 0) /*本周第一天*/
SELECT DATEADD(mm, DATEDIFF(mm,0,getdate()), 0) /*本月第一天*/
SELECT DATEADD(qq, DATEDIFF(qq,0,getdate()), 0) /*本季第一天*/
SELECT DATEADD(yy, DATEDIFF(yy,0,getdate()), 0) /*本年第一天*/
Select dateadd(ms,-3,DATEADD(wk, DATEDIFF(wk,0,GETDATE())+1, 0)) /*本周最后一天*/
Select dateadd(ms,-3,DATEADD(mm, DATEDIFF(mm,0,GETDATE())+1, 0)) /*本月最后一天*/
Select dateadd(ms,-3,DATEADD(qq, DATEDIFF(qq,0,GETDATE())+1, 0)) /*本季最后一天*/
Select dateadd(ms,-3,DATEADD(yy, DATEDIFF(yy,0,GETDATE())+1, 0)) /*本年最后一天*/
标签:sp bs ad sql nbsp c select date qq
原文地址:http://www.cnblogs.com/springxie/p/4065077.html