on 2013 Feb 14 6:06 PM
Is it possible from within a stored procedure to zip up files ?
[edit 2013-02-15]
Sorry, most of my response above is bogus... I confused compression with encryption 😞
Since SA v10 the compress() and decompress() functions have had a second parameter named 'algorithm' which when set to 'gzip' can be used to compress/decompress data that can be exchanged outside of the database server and decompressed/compressed using gunzip/gzip.
Example:
-- write compressed contents of variable @data to file data.gz call xp_write_file( 'data.gz', compress( @data, 'gzip' ) ); -- and then decompress it using gunzip call xp_cmdshell( 'gunzip data.gz' );
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's the tie you're wearing in your photo... restricts the bloodflow 🙂
I ended up downloading 7-Zip, writing a bat file to call 7 Zip, and then calling that bat file with an Event. Worked well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What about reading the file with xp_read_file() and using the builtin COMPRESS() function to compress data and write it back to file with xp_write_file()?
Note, I can't tell whether the builtin compression with the "zip" algorithm will be compatible with ordinary zipped files. On Linux, using "gzip" should work that way. - Mark's response may indicate that "zip" itself won't work here as expected...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
[Edit: 2013-02-15 this statement is incorrect - I have corrected my answer to this question]
Also, the question was not clear whether a single file was being zipped or a zip archive (containing multiple files) was wanted.
User | Count |
---|---|
70 | |
9 | |
8 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.