SSIS and determining Day-Of-Week and branching if "Monday"

Bobby P 221 Reputation points
2020-08-17T18:41:37.687+00:00

I want to evaluate the Day-Of-The-Week and then branch to an Execute SQL Task that will derive my @GloabalStartDate and GlobalEndDate Variables to set Friday thru Sunday if the Day-Of-The-Week is determined to be "Monday".

Can someone share how I do this? Do I have to derive the Day-Of-The-Week first with an Execute SQL Task...

SELECT DATENAME(WEEKDAY, GETDATE()) AS [DayOfWeek]

Result Set that to User::DayOfWeek

And then create an Expression Task to Evaluate it?

I tried just using a constraint but it doesn't seem to like...

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,502 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Monalv-MSFT 5,896 Reputation points
    2020-08-18T03:16:40.923+00:00

    Hi BobbyP,

    May I know how do you configure the tasks in your ssis package?

    We can use the following expressions in the Precedence Constraints.
    Expression 1: DATEPART("weekday", GETDATE() )==2
    Expression 2: DATEPART("weekday", GETDATE() )!=2

    Please refer to the link and the pictures below:
    Using Expressions On Precedence Constraints in Integration Services
    18139-cf.png
    18211-pc.png

    Best Regards,
    Mona

    ----------

    If the response is helpful, please click "Accept Answer" and upvote it.