sp_OADestroy (T-SQL)

Destroys a created OLE object.

Syntax

sp_OADestroy objecttoken

Arguments
objecttoken
Is the object token of an OLE object previously created by sp_OACreate.
Return Code Values

0 (success) or a nonzero number (failure) that is the integer value of the HRESULT returned by the OLE Automation object.

For more information about HRESULT Return Codes, see OLE Automation Return Codes and Error Information.

Result Sets

None

Remarks

If sp_OADestroy is not called, the created OLE object is automatically destroyed at the end of the batch.

Examples

This example destroys the previously created SQLServer object.

EXEC @hr = sp_OADestroy @object

IF @hr <> 0

BEGIN

    EXEC sp_displayoaerrorinfo @object, @hr

    RETURN

END

  

See Also
Data Type Conversions Using OLE Automation Stored Procedures How to debug a custom OLE Automation server (Transact-SQL)
How to create an OLE Automation object (Transact-SQL) OLE Automation Sample Script

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.