question

Raj More avatar image
Raj More asked

File Compression SSIS

What component do I use to compress files using SSIS in 2008 R2? I cannot install any third party software to do this.
ssissql-server-2008-r2compressionzip
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
KenJ avatar image
KenJ answered

You can use an [execute process task][1] to call a compression program.

here is a walk-through using 7-zip: https://www.sqlservercentral.com/articles/using-ssis-to-zip-files-and-email-the-zipped-files-1

**EDIT**

A couple of possibilities using MS tools instead of 3rd party:

- Script Task using .NET [system.io.compression][3] - Powershell script ([here][4] is an example) called from the execute process task

**/EDIT**

[1]: http://technet.microsoft.com/en-us/library/ms141166.aspx [3]: http://msdn.microsoft.com/en-us/library/system.io.compression.aspx- [4]: http://wannemacher.us/?p=225

5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Oleg avatar image Oleg commented ·
@Raj More Read through the article's discussions. Some of them offer using SharpZipLib, which could be a better option than using a third-party app. SharpZipLib **is** technically a third-party assembly, but it does not really require an installation, and it exists simply to allow compressing / decompressing files using managed code. So, instead of using **process task** you can use **script task** which will only require you to add a reference to SharpZipLib assembly and write few lines of .NET code. In case you cannot drop the dll on your server's hard drive then you can actually download the source code of the SharpZipLib and use it in your script task. This would be an overkill though. If I were tasked to have the SSIS package with zip capabilities, I would definitely go for script task and SharpZipLib.
1 Like 1 ·
Raj More avatar image Raj More commented ·
I cannot install third party software on the server. 7Zip is not available to me as an option.
0 Likes 0 ·
KenJ avatar image KenJ commented ·
I missed that when i read the initial question
0 Likes 0 ·
Kev Riley avatar image Kev Riley ♦♦ commented ·
@KenJ - you didn't miss that when you read the question, it wasn't there! OP added it in revision 2.
0 Likes 0 ·
KenJ avatar image KenJ commented ·
Thanks @Kev. I thought I was losing it for a moment!
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.