sqlserver时间函数

http://wenku.baidu.com/view/b944580d844769eae009ed9c.html 

获得当前日期所在周的最后一天,即周日

的算法:

select id,create_time,
case when datepart(weekday,create_time) !=1
 then dateadd(weekday,8-datepart(weekday,create_time),create_time)
else  create_time end  as 'the last day of the week'
from philips2.T_SL_SALES_CHK_OUT_BILL where id=502992 or id=503072 order by id desc;

你可能感兴趣的:(算法,sqlserver)