Access a Linked Server in Microsoft SQL Server

You can use four types of syntax to access the Historian OLE DB Provider as a linked server:

  • OPENQUERY
  • Four-Part Name Syntax
  • OPENROWSET
  • OPENDATASOURCE

OPENQUERY is the recommended method of accessing data by means of a linked server. This method requires that you preconfigure a linked server definition. Then, use that linked server name in the OPENQUERY command. Four-part name syntax also requires that you preconfigure a linked server definition.

OPENROWSET and OPENDATASOURCE are considered ad hoc methods of accessing data via an OLE DB provider. They are recommended only for infrequently accessed data. When using either syntax, you must specify the data source, username, and password in each query instead of configuring it once in a linked server definition. If you want to limit the number of users to a defined set of servers and user names, you can disallow all methods of ad hoc access by selecting the Disallow Adhoc Accesses option in the Provider Options dialog box.

The sections that follow provide some examples of each syntax type.