Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Call a task based on a specific date

Author  Topic 

qman
Constraint Violating Yak Guru

442 Posts

Posted - 2010-12-10 : 09:53:20
I have a package containing multiple tasks. Some of these tasks need to run on a specific month (Jan and April) of the year.
The other tasks run normal at runtime.

Does anyone know how this can be accomplished within SSIS?

Thanks

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2010-12-10 : 10:12:45
Double click on the connector and you can use an expression to set whether the task is run.
Can also use an expression to enable/disable the task in the task properties. You might want to use a sequence container for this.

I would consider setting a variable and using that in the expressions to control processing.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

qman
Constraint Violating Yak Guru

442 Posts

Posted - 2010-12-10 : 10:58:27
Great, thanks for the suggestions. Let me have a look.
Go to Top of Page

qman
Constraint Violating Yak Guru

442 Posts

Posted - 2010-12-10 : 11:56:39
Disabling the task using an expression worked like a charm.

Expression tied to the tasks disable property looks like:

MONTH(GETDATE()) == 01
Go to Top of Page

qman
Constraint Violating Yak Guru

442 Posts

Posted - 2010-12-10 : 12:07:52
Although, why does this not evaluate to "False"?

Task Disable Property.
Expression used to disable, see below

MONTH(GETDATE()) != 03 ||
MONTH(GETDATE()) != 06 ||
MONTH(GETDATE()) != 09 ||
MONTH(GETDATE()) != 12

It evaluates to True but I expect False since it is December.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-12-10 : 13:39:15
NOT OR NOT on the same column/value is always true!

If month is = 3 then your next lines are true because 6,9,12 are != 3
If month is = 6 then your first line and the other lines are true and so on...

You need AND instead of OR


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

qman
Constraint Violating Yak Guru

442 Posts

Posted - 2010-12-10 : 13:47:21
Thanks, tough to get my head around that one.

Using && did it.....
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-12-10 : 14:26:25
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -