Extract Query result from SQL server in SSIS into CSV flat file , Compress CSV and send the CSV File by email


I have a query to extract records of about 7 million rows in SSIS from SQL server. I then need to dump the data as CSV , and then compress the CSV file to be able to mails it using my smtp server with the send mail task.

The tricky part is :   How to compress the CVS fils in SSIS possibly using a Script component.

Your help is appreciated .Other solutions will be accepted apart from my requested solution.

Who is Participating?
Bhavesh ShahConnect With a Mentor Lead AnalysistCommented:
You could use a operating system comand an do it that, i have seen this done before which worked fine. You just need to be able to execute a zip program.
subhashpuniaConnect With a Mentor Commented:
You can perform these tasks as below:

1. Export to CSV : can be performed by SSIS
2. ZIP : You can use shareware tools like 7-zip command line and use the command like 7za.exe ....
3. Mail the file by using the SQL server's Database Mail utility. To know more about how to configure database pls check this post:

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.