datediff ,datepart周

 

set datefirst 1
select DATEDIFF(wk,'2011-10-30 ','2011-11-1'),
DATEPART(ww, '2011-10-30'),
DATEPART(ww, '2011-11-1')


返回

0,44,45 

set datefirst 7
select DATEDIFF(wk,'2011-10-30 ','2011-11-1'),
DATEPART(ww, '2011-10-30'),
DATEPART(ww, '2011-11-1')

返回

0,45,45 

 

奇怪为啥datefirst设置了,对datepart有效但是对datediff就无效

 

posted on 2011-11-01 10:41  聪明的大熊  阅读(244)  评论(0编辑  收藏  举报