how to automate zipping of files from sql

59 Views Asked by At

I have an SQL table which has results for each period(e.g. Jan 2013). These are the steps that I follow:

  1. I want to select records from each period.
  2. Put the results into a CSV file.
  3. Then copy the headers and save the CSV file to a text file with different name.
  4. Then take the text file and gzip that file.
  5. Now find the records that are in the text file and create a counts file. (.txt)
  6. Now take that gzip file and counts file and create a .tar file.
  7. Again create a counts file that points to .tar file.

I have to do these steps for all the periods that are in that table.

Is there an easier way to do this, like a Perl/Python script or a Batch file or something?

0

There are 0 best solutions below