SQL Server
SQL Server
Transition from Crypt2.Decode to BinData.AppendEncoded
Provides instructions for replacing deprecated Decode method calls with AppendEncoded.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 @crypt2 int
EXEC @hr = sp_OACreate 'Chilkat.Crypt2', @crypt2 OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
-- ...
-- ...
DECLARE @encoding nvarchar(4000)
SELECT @encoding = 'base64'
-- ------------------------------------------------------------------------
-- The Decode method is deprecated:
EXEC sp_OAMethod @crypt2, 'Decode', @byteData OUT, 'ENCODED_DATA...', @encoding
-- ------------------------------------------------------------------------
-- Do the equivalent using BinData.AppendEncoded.
DECLARE @bd int
EXEC @hr = sp_OACreate 'Chilkat.BinData', @bd OUT
EXEC sp_OAMethod @bd, 'AppendEncoded', @success OUT, 'ENCODED_DATA...', @encoding
EXEC sp_OAMethod @bd, 'GetData', @byteData OUT
EXEC @hr = sp_OADestroy @crypt2
EXEC @hr = sp_OADestroy @bd
END
GO