sp_OADestroy

Destroys a created OLE object.

Syntax

sp_OADestroy objecttoken

where

objecttoken
Is the object token of an OLE object previously created by sp_OACreate.

Remarks

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

This procedure returns a 0 when successful or a non-zero HRESULT when an error occurs.

Example

This example destroys the previously created SQLServer object.

EXEC @hr = sp_OADestroy @object
IF @hr <> 0
BEGIN
    EXEC sp_displayoaerrorinfo @object, @hr
    RETURN
END