Groups | Blog | Home
all groups > sql server dts > november 2006 >

sql server dts : Running parts of sql jobs depending on date


Arnie Rowland
11/9/2006 9:36:07 AM
It's not unusual to have Jobs that execute ONLY on Jan 1st. Archive data,
create tables, partition tables, etc.

--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous

You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf


[quoted text, click to view]

Blasting Cap
11/9/2006 11:28:51 AM
I have to write some sql that has to create a table from which a report
runs that spans over the end of this year.

It's code to build a table that a sales program report is generated
from. The program itself runs until the end of January.

From now thru January 2, orders in the program count. On January 3, I
get a new table - the one I had been using gets changed to a previous
year table, and the new one is the current year table. Also on that
day, instead of orders counting (in the previous year) it goes to
shipments. Orders count in the new (current year) table.

The best way I can come up with to do this is to put in some code in the
table build that builds it one day if getdate() is >= 01/03/2007, and
another way if it's not.

Is there a better way to do something like this, perhaps thru DTS?

What I had in mind is to do something like this:

if getdate() <= '01/02/2007'
begin

several passes at building the table



end -- if getdate <= 01/02/2007



if getdate() >= '01/03/2007'
begin

several passes at building the table



AddThis Social Bookmark Button