SQL Server 2008-如果日期在周末落下,则增加到下周一
-
14-11-2019 - |
题
在SQL Server中,我根据某些业务规则计算日期。如果日期落在一个周末,我需要将它搬到下一个星期一......所以基本上是:
if(date == saturday)
{
add 2 days
}
if(date == sunday)
{
add 2 day
}
.
什么是最简单的完成方法?
解决方案
其他提示
Use DATENAME
as per MSDN.
Example: select datename(weekday, getdate())
returns Thursday as of today.
不隶属于 StackOverflow