June 19, 2024 at 12:00 am
Comments posted to this topic are about the item Unzipping Word Documents in T-SQL
June 19, 2024 at 8:42 am
Wow, you've obviously had a lot of 'fun' with this, well done!
Suggesting that image files are not compressed is, however, incorrect. They are heavily compressed, just not using Zip.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
June 19, 2024 at 1:12 pm
You are right Phil. Images are heavily compressed. I did not express myself correctly as I meant that images are not compressed XML files. You are also right saying I had fun writing this function!
June 19, 2024 at 9:35 pm
Pretty cool, just one thing to consider.
SQL is the most expensive CPU license that one might pay for.
For that reason, I'm out...
June 19, 2024 at 10:17 pm
Wow! Ingenious.
It's surprising that DECOMPRESS(..) and COMPRESS(..) work with true gzip files (rather than a raw stream from the deflate algorithm) but then I suppose anyone wanting compressed storage for SQL Server should use the built-in compression features, and this function is just for those oddball "interoperate with other systems" type situations.
I'm impressed you construct a fake GZIP file by assembling the header, deflate contents, CRC32 etc from the data that's stored in the ZIP directory.
I can see how this is useful for one off tasks when you have ten thousand docx file and nobody bothered to store the metadata (author, title, etc) for each file in a nice normal table!
June 20, 2024 at 2:58 pm
Hello Brain2000,
You are right mentioning that SQL Server licenses are expensive, and I admit that unzipping on the server is unusual and unexpected.
Like Ool2t5902 mentions, I use the function to extract metadata. Actually, I use a stripped version of the function that only decompresses and returns the required xml file, and this is pretty fast. I published a full function for clarity purposes.
Thanks.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply