SQL Server Stored Procedure Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

SQL Server
Stored Procedure Examples

Quick Start
Encryption
File Access
IMAP
POP3
SMTP
Email Object
DKIM / DomainKey
FTP
HTML Conversion
HTTP
MHT
MIME
NTLM
RSA
Diffie-Hellman
DSA
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
String
Tar
Upload
XML
XMP
Zip

Amazon S3
Bz2
CSV
FileAccess
Byte Array
RSS
Atom
Self-Extractor

Extract XMP MetaData as XML

Demonstrates how to open a JPG or TIF image file and extract the XMP metadata as XML.

CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    DECLARE @sTmp0 nvarchar(4000)

    DECLARE @xmp int
    EXEC @hr = sp_OACreate 'Chilkat.Xmp', @xmp OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    EXEC sp_OAMethod @xmp, 'UnlockComponent', @success OUT, 'Anything for 30-day trial.'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @xmp, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        RETURN
      END

    --  Load a JPG or TIF image file.
    --  Sample JPG's with XMP metadata may be found at:
    --  http://www.chilkatsoft.com/testData/xmp/sample1.jpg
    --  http://www.chilkatsoft.com/testData/xmp/sample2.jpg
    --  http://www.chilkatsoft.com/testData/xmp/sample3.jpg
    EXEC sp_OAMethod @xmp, 'LoadAppFile', @success OUT, 'sample1.jpg'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @xmp, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        RETURN
      END


    EXEC sp_OAGetProperty @xmp, 'NumEmbedded', @iTmp0 OUT

    PRINT 'Num embedded XMP docs: ' + @iTmp0

    --  Assuming there is at least one, get the 1st.
    --  (There is typically never more than one, but theoretically it's possible.)
    DECLARE @xml int

    EXEC sp_OAMethod @xmp, 'GetEmbedded', @xml OUT, 0
    IF Not (@xml Is NULL )
      BEGIN
        EXEC sp_OAMethod @xml, 'SaveXml', @success OUT, 'xmpMetaData.xml'
        IF @success <> 1
          BEGIN
            EXEC sp_OAGetProperty @xml, 'LastErrorText', @sTmp0 OUT
            PRINT @sTmp0
          END

        PRINT 'Success.'

      END
    ELSE
      BEGIN
        EXEC sp_OAGetProperty @xmp, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
      END

END
GO

 

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.