Using TSQL to Unzip a value

2019-07-16 12:12发布

问题:

How can I unzip a varbinary(max) value in a stored procedure? I'd like to implement or invoke a gunzip algorithm within TSQL code, preferably without enabling the CLR.

回答1:

Look into sp_OACreate http://msdn.microsoft.com/en-us/library/ms189763.aspx

sp_oamethod http://msdn.microsoft.com/en-us/library/ms174984.aspx

You can write the value as a file using file system object, then use a command line gunzip program on it and the read the file using FSO back.

Yes this is not practical but I am not the type of guy who thinks in terms of impossible.