I think the following is good but wondering if it can be simplified or improved.
My condition for code execution is the following:
It is a Monday AND It is not the Monday following the last Saturday in the month.
This is the current
DECLARE @now DATETIME = DATEADD(dd,DATEDIFF(dd,'19000101',SYSDATETIME()),'19000101'); IF ( (--is it a monday? SELECT DATEPART(dw,@now) ) = 2 AND (--is it not the monday following the last Saturday of the month? ( SELECT DATEDIFF( DAY, @now-2, DATEADD(MONTH,DATEDIFF(MONTH,0,@now-2)+1,0)-1 ) ) > 6 ) ) BEGIN; ... ... END;