Export (0) Print
Expand All
Expand Minimize

sp_OASetProperty

SQL Server 2000

Sets a property of an OLE object to a new value.

Syntax

sp_OASetProperty objecttoken,
    propertyname,
    newvalue
    [ , index... ]

Arguments

objecttoken

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

propertyname

Is the property name of the OLE object to set to a new value.

newvalue

Is the new value of the property, and must be a value of the appropriate data type.

index

Is an index parameter. If specified, it must be a value of the appropriate data type.

Some properties have parameters. These properties are called indexed properties, and the parameters are called index parameters. A property can have multiple index parameters.

Note  The parameters for this stored procedure are specified by position, not name.

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.

Permissions

Only members of the sysadmin fixed server role can execute sp_OASetProperty.

Examples

This example sets the HostName property (of the previously created SQLServer object) to a new value.

EXEC @hr = sp_OASetProperty @object, 'HostName', 'Gizmo'
IF @hr <> 0
BEGIN
   EXEC sp_OAGetErrorInfo @object
    RETURN
END

See Also

Data Type Conversions Using OLE Automation Stored Procedures

How to create an OLE Automation object (Transact-SQL)

How to debug a custom OLE Automation server (Transact-SQL)

OLE Automation Sample Script

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft