Sequence Container Trigger Ssis
I Have Build an Etl Package with Two Sequence Containers. One for a Full Load and One for a Incremental Load. I Want the Package to Excecute the Incremental...
I have build an ETL package with two sequence containers. One for a full load and one for a incremental load.
I want the package to excecute the incremental load each "normal" day When it is a sunday to execute the full load
Do i need to use a script task for this?
3 Answers
There are a number of ways to accomplish this. One fairly straight forward way would be to add an Execute SQL Task ahead of your two Sequence Containers with some code to determine the day of the week.
This is pretty clear in it's intention:
SELECT
CASE
WHEN DATENAME(WEEKDAY, GETDATE()) = 'Sunday' THEN 1
ELSE 0
END;
Set the result set to Single Row, and on the Result Set tab, assign the query output to a variable.
Create a Precedence Constraint from the task to the incremental container. Edit the constraint to be an Expression and Constraint and specify that @[User::MyVariable]==0.
Create another constraint to the full refresh container, but specify the variable value as 1.
There are a few different ways to solve this.
Must Read
First approach
The first way is through an Expression on each of your Sequence Containers. The Expressions will control the Disable state of the container and the expression you are looking for is DATEPART for a Weekday dw
Is it Sunday?
DATEPART("weekday", getdate()) == 1
Is it not Sunday?
DATEPART("weekday", getdate()) != 1