sp_OADestroy (Transact-SQL)

Destroys a created OLE object.

Ikona łącza do tematu Transact-SQL Syntax Conventions

Składnia

sp_OADestroy objecttoken    

Arguments

  • objecttoken
    Is the object token of an OLE object that was previously created by using 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.

Uwagi

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

Permissions

Requires membership in the sysadmin fixed server role.

Examples

The following example destroys the previously created SQLServer object.

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

Zobacz także

Odwołanie

OLE Automation Stored Procedures (Transact-SQL)

OLE Automation Sample Script