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

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

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

你可能感兴趣的:(存储过程)