user2368236
user2368236

Reputation: 1

How to run SSIS package for previous date

I am executing a SQL task in SSIS package in which in am using todays date by getdate() funciton in SQL. for some reason if my package didn't run for a day and I want to run manually then what is the best practice to do this?

Upvotes: 0

Views: 343

Answers (1)

Nick.Mc
Nick.Mc

Reputation: 19245

How do you intend to run it manually? from BIDS? Normally you'd have a some kind of control table, and your package would look into this table to decide what to do. For example you could have a table called SSISControl with a column called DaysOffset which is normally 0. Your SSIS loads the value into a variable then subtracts this variable from GETDATE()

If you were to set this column to 1, it would subtract 1 from GETDATE()

As you can see you need to prebuild this into your package.

The exact design of the control table is dictated by what you want to control. For example you might want to unpivot the fields into rows instead.

Another way to do this (and would not be best practice) is to just set the offset variable directly in BIDS and run the package.

Upvotes: 1

Related Questions