(SQL Server) UnGzip .tgz to get a .tar
      
      A .tgz is simply a TAR archive compressed using GZip.  It is also commonly referred to as a .tar.gz.   Chilkat GZip can be used to ungzip to get an uncompressed .tar. 
		
 
      -- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @gzip int
    -- Use "Chilkat_9_5_0.Gzip" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.Gzip', @gzip OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END
    DECLARE @success int
    EXEC sp_OAMethod @gzip, 'UncompressFile', @success OUT, 'qa_data/tar/test.tgz', 'qa_output/test.tar'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @gzip, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
      END
    ELSE
      BEGIN
        PRINT 'success.'
      END
    EXEC @hr = sp_OADestroy @gzip
END
GO
     |