LinkedServer Object

この機能は、将来のバージョンの Microsoft SQL Server では削除される予定です。新規の開発作業ではこの機能を使用しないようにし、現在この機能を使用しているアプリケーションは修正することを検討してください。

The LinkedServer object exposes the properties of an OLE DB data source and allows directed Transact-SQL queries against defined data sources.

現在のオブジェクトを表す SQL-DMO オブジェクト モデル

Properties

Catalog Property

Options Property

DataSource Property

ProductName Property

DropLogins Property

ProviderName Property

Location Property (LinkedServer)

ProviderString Property

Name Property

 

Methods

EnumColumns Method

ExecuteWithResultsAndMessages Method

EnumTables Method

Remove Method (Objects)

ExecuteImmediate Method (LinkedServer, RemoteServer)

SetOptions Method

ExecuteWithResults Method

 

解説

Microsoft SQL Server 2000 and later supports Transact-SQL queries against data stored in one or more SQL Server and heterogeneous databases. SQL Server distributed queries use OLE DB to access a non-local data store.

OLE DB defines a provider as an OLE DB component that can deliver data from a store. Typically, OLE DB providers can discriminate among applicable, available data stores. OLE DB defines a data source as that information necessary for the successful delivery of data from the store (such as a user identifier and password).

SQL Server implements persistent storage of an OLE DB provider name and data source definition called a linked server.

With the LinkedServer object, you can:

  • Create an OLE DB data source definition, usable as a data provider for a distributed query.
  • List the tables of a data source or the columns contained in a data source table.
  • Execute a Transact-SQL statement against a SQL Server OLE DB data source.
  • Remove existing data source defining records.

The Name property of a LinkedServer object uses the SQL Server data type sysname. The value of the Name property must be unique within an instance of SQL Server.

To create a linked server

  1. Create a LinkedServer object.

  2. Set the Name property.

  3. Set the ProviderName property to indicate the OLE DB provider. For more information about providers available for SQL Server, see SQL Server でテスト済みの OLE DB プロバイダ.

  4. Set any additional property values required by the provider. For more information about provider-required values, see the OLE DB provider documentation.

  5. Add the LinkedServer object to the LinkedServers collection of a connected SQLServer object.

ms132915.note(ja-jp,SQL.90).gifメモ :
When a linked server is created, SQL Server creates a default linked server login record. When SQL Distributed Management Objects (SQL-DMO) is used to create a linked server, adding the LinkedServer object to its containing collection creates the linked server and the default linked server login. The object's LinkedServerLogins collection contains one member. For more information about the default linked server login created, see sp_addlinkedsrvlogin (Transact-SQL).
ms132915.note(ja-jp,SQL.90).gifメモ :
The LinkedServer object is compatible with instances of SQL Server versions 7.0 and later. However, the LinkedServer2 object extends the functionality of the LinkedServer object for use with features that were introduced in SQL Server 2000.

参照

関連項目

LinkedServer2 Object

ヘルプおよび情報

SQL Server 2005 の参考資料の入手