Sunday, February 26, 2012

File Rotation

Hi,
I currently have a job setup to export a view from a MS
SQL 2000 database to a CSV file on a network drive..
Let's say the filename is: filename.csv
The job runs every 10minutes, and I need it to save to
different file names for 7 days, then start back..
day 1: filename1.csv ..10minutes later would be
filename2.csv etc...
After 7 days it would go back to filename1.csv..
I hope I'm being clear here but I'm sure someone gets the
idea.. anyone has a tip?Guillaume
How about using the day of the week as part of the
filename and overwriting if the file name exists. ie
filename-mon.csv, filename-tue.csv etc or you could just
set up a small (one row, one column) table on your
database where you keep a number or some other identifier
to append to the file name. If you start with '1' as your
initial value, add 1 each day and when it gets to 8 reset
to 1. Filename1.csv, filename2.csv etc
Hope this helps
Regards
John

No comments:

Post a Comment