SQL Server 2008- If date falls on weekend, Increase to next Monday

2.2k Views Asked by At

In SQL Server I am calculating a date based on certain business rules. If the date falls on a weekend I need to move it up to the next monday...so basically:

if(date == saturday)
{
 add 2 days
}
if(date == sunday)
{
  add 2 day
}

What is the easiest way to accomplish this?

2

There are 2 best solutions below

0
On BEST ANSWER
0
On

Use DATENAME as per MSDN.

Example: select datename(weekday, getdate()) returns Thursday as of today.