'MSSQL: How to extract binary data compressed into a text field?

Got a weird database I need to kind of reverse engineer. I assume the original data is either RTF or some binary Word document, and it is surely compressed, because we were told by the authors. The collation is Latin1_General_CI_AS. Why the heck would they store it as text is above me.

So the question is, how could I extract this data? I'm think somehow to convert the text to varbinary, then UNCOMPRESS(), and somehow export the result into a file.

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source