SQL Server
SQL Server
Transition from Zip.AppendSb to Zip.AddSb
Provides instructions for replacing deprecated AppendSb method calls with AddSb.Chilkat SQL Server Downloads
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @success int
SELECT @success = 0
DECLARE @zip int
EXEC @hr = sp_OACreate 'Chilkat.Zip', @zip OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
-- ...
-- ...
DECLARE @pathInZip nvarchar(4000)
SELECT @pathInZip = 'example.txt'
DECLARE @sb int
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sb OUT
EXEC sp_OAMethod @sb, 'Append', @success OUT, 'This is a test'
DECLARE @charset nvarchar(4000)
SELECT @charset = 'utf-8'
-- ------------------------------------------------------------------------
-- The AppendSb method is deprecated:
EXEC sp_OAMethod @zip, 'AppendSb', @success OUT, @pathInZip, @sb, @charset
-- ------------------------------------------------------------------------
-- For consistency, the name has changed to AddSb.
EXEC sp_OAMethod @zip, 'AddSb', @success OUT, @pathInZip, @sb, @charset
EXEC @hr = sp_OADestroy @zip
EXEC @hr = sp_OADestroy @sb
END
GO