• Home
        • Database Development

          Database development is designing, creating a database or data model, and analyzing requirements and their intents as raw data.

          Learn More
        • Architecture & Design

          Software architecture refers to the fundamental structures of a software system and the discipline of creating such structures and systems.

          Learn More
        • Programming

          Computer programming is the process of performing a particular computation or more generally, accomplishing a specific result.

          Learn More
        • Cloud Computing

          Cloud computing is the on-demand availability of computer system resources, especially data storage and computing power.

          Learn More
        • ETL Development

          ETL provides the foundation for data analytics and machine learning workstreams. Through a series of business rules, ETL cleanses and organizes data.

          Learn More
        • Data Visualization & Reports

          Data and information visualization is an interdisciplinary field that deals with the graphic representation of data and information.

          Learn More
  • Blog
  • Contact

Abstract

In this blog post I will demonstrate using SQL Server Integration Services‘s Execute Process Task to compress a csv file into a zip format using 7-Zip.

Requirements

Article
Recently I have been involved in a project whereby I have been required to extract data into CSV files, compress the files into a zip format and email the newly compressed files. This blog post is the first of several posts to come whereby I will be demonstrating how to fulfill such a requirement.
Let’s begin by launching Microsoft Visual Studio and creating a new Integration Services Project which is located under Business Intelligence Projects category. (If you are using SQL Server 2012 or later, you will have to launch SQL Server Data Tools – SSDT).
After you have assigned a project name, proceed to click and drag the Execute Process Task (EPT) into the Control Flow pane from the toolbox (SSIS Toolbox in SSDT).
Right-click EPT and click on “Edit”
Under the General Tab, you can assign relevant Names & Descriptions. In this case, I have decided to name the task “EPT – Compress File” whilst the Description remains unchanged.
In the Process Tab, the EPT properties must be set as follows:

  • RequiredFullFileName : True
  • Executable : C:\Program Files\7-Zip\7zG.exe
  • Arguments: a “SIFISO_Test.zip” “SIFISO_Test.csv”
  • WorkingDirectory: C:\Test\Excel\20120930\
  • FailTaskIfReturnCodeIsNotSuccessValue : True
  • SuccessValue : 0
  • Timeout : 0
  • WindowStyle : Hidden

Basically what we have done above is, among other things, set the Executable property to the .exe location of the compression software we are using; set the Arguments such that file “SIFISO_Test.csv” is compressed into “SIFISO_Test.zip”; specified the working directory where the CSV file will be located and zip file created; hid the exe window that appears when the file is being compressed.
It’s that simple.
Till next time folks, cheers.
Sifiso.
CodeProject

Loading

Sifiso

October 13, 2022
Sifiso is Data Architect and Technical Lead at SELECT SIFISO – a technology consulting firm focusing on cloud migrations, data ingestion, DevOps, reporting and analytics. Sifiso has over 15 years of across private and public business sectors, helping businesses implement Microsoft, AWS and open-source technology solutions. He is the member of the Johannesburg SQL User Group and also hold a Master’s Degree in MCom IT Management from the University of Johannesburg.

Meet Our Experts

We are proud to have a team of experts who are passionate about delivering the best possible solutions to you. Our team members are highly skilled and experienced in a diverse range of IT technologies, and are committed to staying up-to-date with the latest industry trends and best practices to deliver you the best results.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Join Our Newsletter

Subscribe to get our latest and best thinking on the most definitive workforce topics affecting HR leaders and organizations today.