Sample code for 30+ languages & platforms
SQL Server

Example: Crypt2.CrcFile method

Demonstrates how to call the CrcFile method.

Chilkat SQL Server Downloads

SQL Server
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @crypt int
    EXEC @hr = sp_OACreate 'Chilkat.Crypt2', @crypt OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @filePath nvarchar(4000)
    SELECT @filePath = 'c:/temp/someFile.dat'

    DECLARE @crc32 int
    EXEC sp_OAMethod @crypt, 'CrcFile', @crc32 OUT, 'crc-32', @filePath

    PRINT @crc32

    DECLARE @crc8 int
    EXEC sp_OAMethod @crypt, 'CrcFile', @crc8 OUT, 'crc8', @filePath

    PRINT @crc8

    EXEC @hr = sp_OADestroy @crypt


END
GO