小记存储过程中经常用到的本周,本月,本年函数

5/19/2006来源:SQL技巧人气:14650

1Dateadd(wk,datediff(wk,0,getdate()),-1)                             
2Dateadd(wk,datediff(wk,0,getdate()),6)
3
4Dateadd(mm,datediff(mm,0,getdate()),0)
5Dateadd(ms,-3,dateadd(mm,datediff(m,0,getdate())+1,0))
6
7Dateadd(yy,datediff(yy,0,getdate()),0)
8Dateadd(ms,-3,DATEADD(yy, DATEDIFF(yy,0,getdate())+1, 0))

http://zjy.cnblogs.com/archive/2006/05/18/403505.html