The SetOptions method modifies configurable parameters for a Microsoft® SQL Server™ remote or linked server.
LinkedServer Object | RemoteServer Object |
object.SetOptions( Option , Setting )
Part | Description |
---|---|
object | Expression that evaluates to an object in the Applies To list. |
Option | Long integer identifying one or more options as described in Settings. |
Setting | When True, the options identified in Option are enabled. When False, the options identified in Option are disabled. |
When setting the Option argument specifying multiple behaviors, combine values by using an Or. Set the Option argument by using these values.
Constant | Value | Description |
---|---|---|
SQLDMOSrvOpt_ CollationCompatible |
256 | Linked-to server uses ordering and character comparison identical to that used by the local server. (LinkedServer object only) |
SQLDMOSrvOpt_DataAccess | 128 | Linked-to server is available to the local server as a distributed query participant. (LinkedServer object only) |
SQLDMOSrvOpt_DistPublisher | 16 | Linked-to server is a publication Distributor for the local server. (RemoteServer object only) |
SQLDMOSrvOpt_Distributor | 8 | Linked-to server is a replication Distributor. (RemoteServer object only) |
SQLDMOSrvOpt_ DynamicParameters |
16384 | Linked-to server recognizes the ODBC-specified ? character as a parameter representation in a query statement. (LinkedServer object only) |
SQLDMOSrvOpt_ IndexAsAccessPath |
2048 | Provider-implemented indexes will be used as an access path for distributed query against the server linked-to. (LinkedServer object only) |
SQLDMOSrvOpt_InProcess | 1024 | Launches the OLE DB provider implementing the linked-to data source as a COM in-process server. (LinkedServer object only) |
SQLDMOSrvOpt_LevelZeroOnly | 4096 | When accessing the linked-to server, distributed query will use only OLE DB Level 0 support. (LinkedServer object only) |
SQLDMOSrvOpt_NestedQueries | 8192 | Linked-to server supports the SELECT statement in the FROM clause of a query. (LinkedServer object only) |
SQLDMOSrvOpt_NonTransacted | 512 | Distributed query will allow update to the linked-to server regardless the presence of transaction support. (LinkedServer object only) |
SQLDMOSrvOpt_Publisher | 2 | Linked-to server publishes data to the local server. (RemoteServer object only) |
SQLDMOSrvOpt_RPC | 1 | Local server accepts remote procedure calls made by the linked-to server. |
SQLDMOSrvOpt_RPC_out | 64 | Linked-to server accepts remote procedure calls from the local server. (LinkedServer object only) |
SQLDMOSrvOpt_Subscriber | 4 | Linked-to server subscribes to replication publications on the local server. (RemoteServer object only) |
Setting options in error can cause unintended results. For example, when SQL Server links to an OLE DB data source, the user can indicate that the data source linked-to uses character set and collation sequence identical to that used by the linking SQL Server installation. The user can accomplish this task by using the SetOptions method of the LinkedServer object, setting Option to SQLDMOSrvOpt_CollationCompatible and setting Setting to True. Distributed query uses character set and collation sequence compatibility to optimize query resolution. If the value is set in error, distributed query can return erroneous results.
HRESULT SetOptions(
SQLDMO_SRVOPTION_TYPE Options,
BOOL NewValue);