<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[yellowfishtom的专栏]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/yellowfishtom</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; yellowfishtom]]></copyright><item><title><![CDATA[解决sql server使用DateDiff函数时，一周第一天不是周一而是星期天的问题]]></title><link>https://blog.youkuaiyun.com/yellowfishtom/article/details/105049516</link><guid>https://blog.youkuaiyun.com/yellowfishtom/article/details/105049516</guid><author>yellowfishtom</author><pubDate>Mon, 23 Mar 2020 15:32:59 +0800</pubDate><description><![CDATA[如题，使用Datediff函数时，如想获取日期单位为周的数据时，发现函数默认一周第一天是星期天，并非中国传统的星期一，即便在查询开头使用了set DATEFIRST 1； 仍旧改变不了DATEDIFF。



后经Google发现了一个委婉的解决办法，我们不能直接改变DATEDIFF，但可以修改里面的两个日期值。

eg: DATEDIFF(WK,DATEADD(DD,-@@DATEFIRST,...]]></description><category></category></item></channel></rss>