SQLLinkedServers returns a list of data sources that can participate in distributed queries.
SQLRETURN SQLLinkedServers(
SQLHSTMT hstmt)
SUCCEED or FAIL.
Microsoft® SQL Server™ linked servers are OLE DB data sources that can be referenced using four-part names in distributed queries. SQLLinkedServers returns the properties defining the data source as a result set. Linked servers are defined to SQL Server using the sp_addlinkedserver system stored procedure. The columns of the result set are defined as follows.
Column name |
Column number | Data type |
Comments |
---|---|---|---|
SRV_NAME | 1 | SQLWCHAR | Name of the linked server. |
SRV_PROVIDERNAME | 2 | SQLWCHAR | Friendly name of the OLE DB provider for this linked server. |
SRV_PRODUCT | 3 | SQLWCHAR | Product name for this linked server. |
SRV_DATASOURCE | 4 | SQLWCHAR | Name that identifies the source of the data to this provider. |
SRV_PROVIDERSTRING | 5 | SQLWCHAR | Provider-specific string that identifies the source of the data. |
SRV_LOCATION | 6 | SQLWCHAR | Location argument that identifies the database to this provider. |
SRV_CAT | 7 | SQLWCHAR | Name of the catalog containing the data on the linked server. |
SRV_PROVIDERSTRING is NULL when the SRV_DATASOURCE and SRV_CAT information is sufficient to identify the source of the data to the provider.
When the linked server is a server running SQL Server, SRV_DATASOURCE is the name of the server, SRV_CATALOG is the name of the database, and SRV_LOCATION is NULL.
Distributed Queries | sp_addlinkedserver |