Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

sp_OADestroy (Transact-SQL)


Applies To: SQL Server 2014, SQL Server 2016 Preview

Destroys a created OLE object.

Applies to: SQL Server (SQL Server 2008 through current version).

Topic link icon Transact-SQL Syntax Conventions

sp_OADestroy objecttoken    


Is the object token of an OLE object that was previously created by using sp_OACreate.

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.

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

Requires membership in the sysadmin fixed server role.

The following example destroys the previously created SQLServer object.

EXEC @hr = sp_OADestroy @object;
IF @hr <> 0
   EXEC sp_OAGetErrorInfo @object
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft