A sales report might need information that belongs to several database systems. Your query window connects to SQL Server Instance A, while the order records reside in a database on Instance B. A linked server gives Instance A a configured way to access that remote data source. You submit the query to A; A communicates with B and returns the results to your client.
This module introduces remote data access in SQL Server 2025. The first lesson explains the connection model, the names used to identify remote objects, and the prerequisites that make a request succeed. Later lessons develop the configuration steps and the alternatives for executing remote queries and stored procedures.
After completing this module, you should be able to:
SQL Server Management Studio (SSMS) is a client application. A SQL Server instance is a Database Engine that accepts connections and manages databases. A database contains objects such as tables, views, and stored procedures. These terms identify different parts of the system, even when several components happen to run on the same computer.
Accessing another database does not necessarily mean accessing another server. Within one SQL Server instance, a three-part name such as SalesDB.dbo.Orders identifies a database, schema, and table. Permissions still apply, but a linked server is not required merely because the table is in a different database on that instance.
For the example in this lesson, A and B are separate SQL Server instances. The linked-server name RemoteB is defined on A and identifies the connection destination for the remote request. It is a local name for that configuration, so it need not be the same as B's computer name. Keep those two names distinct when reading a query or investigating a connection problem.
Read the numbered arrows in order:
The definition is one-way: configuring A to access B does not configure B to initiate queries against A. B would need a separate linked-server definition for that reverse operation. Responses still travel back through the established connection, so one-way configuration does not mean one-way network traffic.
A can also combine remote rows with local data as part of a distributed query. Linked servers use OLE DB providers, and suitable providers can expose supported sources other than SQL Server. Capabilities differ between providers; this lesson uses two SQL Server instances to keep the example consistent. See Microsoft's linked-server overview.
SSMS Registered Servers stores connection information that helps you reconnect to instances you manage. Registering A and B there does not create a linked server between them. These saved client connections are useful for administration, but the engine-to-engine configuration belongs to the SQL Server instance.
For example, opening a query window directly against B lets you query B as that client connection. Opening a query window against A and using RemoteB asks A to access B. The second operation uses A's linked-server configuration and may use a different remote security context. Success with the first connection therefore does not prove that the second path is configured correctly. Microsoft documents Registered Servers as an SSMS connection-management feature.
Assume an administrator has configured RemoteB on A and granted the necessary remote access. With your SSMS query window connected to A, the statement shown in the diagram is:
SELECT OrderID, CustomerID
FROM [RemoteB].[SalesDB].[dbo].[Orders];
The name answers four questions, from the connection destination down to the object:
| Part | Example | Meaning |
|---|---|---|
| Linked server | RemoteB | The linked-server name defined on A. |
| Database | SalesDB | The database on B. |
| Schema | dbo | The schema containing the table. |
| Object | Orders | The remote table being queried. |
Square brackets delimit each identifier. They do not create the link, supply a password, or bypass permissions. The example names must exist in the environment where you run the statement; they are not built-in SQL Server sample objects. Microsoft's linked-server configuration documentation demonstrates this four-part naming pattern.
The example deliberately requests two columns. For a real report, specify the fields and rows the report needs. Assuming this example's CustomerID is an integer, a narrower request might be:
SELECT OrderID, CustomerID
FROM [RemoteB].[SalesDB].[dbo].[Orders]
WHERE CustomerID = 42;
This asks for orders associated with customer 42; it does not guarantee that any matching rows exist. No fixed output is shown because the result depends on your data. In an application, use a parameter with a type that matches the actual column instead of constructing SQL by concatenating user input.
Also distinguish an empty result from a failed query. A statement that completes and returns no rows may simply have no matching customer records. Verify the intended database and business condition before altering connection settings. When comparing a direct query on B with a query through A, use the same object, columns, and filter, and account for changes in the underlying data between tests. Otherwise, different results may reflect different questions or different execution times rather than a broken link. Keep a known, limited test case available so that validation does not require reading an entire production table.
There are two connection paths to consider: the client to A, and A to B. The remote request originates from A's environment. Name resolution, network routing, and firewall rules must allow that server to reach B's Database Engine listener. A desktop test is useful evidence about the desktop's path, not a substitute for checking A's path.
Allow the TCP port on which B actually listens. TCP 1433 is a common default, but a named instance or administrator-selected configuration can use another port. UDP 1434 supports SQL Server Browser discovery when that mechanism is needed. Browser discovery is unnecessary when the connection specifies the instance's TCP port. Do not automatically open both ports for every deployment; follow the actual connection configuration and restrict access to the required hosts. See SQL Server firewall guidance.
On Windows, SQL Server Configuration Manager manages server network protocols such as TCP/IP. A protocol change requires restarting the affected SQL Server service before the change takes effect. Adding a firewall rule is a separate operation and does not, by itself, require restarting SQL Server or rebooting Windows. Plan service restarts with the administrator responsible for the instance. Microsoft describes the procedure under enabling or disabling a server network protocol.
The login used to connect to A does not automatically gain access to every object on B. Linked-server security settings determine how a local connection is mapped to a remote security context. B then applies its own authentication and authorization checks. Creating the linked-server definition and granting permission to read a remote table are distinct administrative tasks.
Configure access for the intended users and workload. A reporting identity usually needs access to specific data, not broad administrative rights. Review both explicit login mappings and the behavior for logins without a mapping; a broadly shared remote identity can expose more data than intended. Credentials should be managed through the approved administrative process rather than copied into lesson scripts or application query text.
Windows authentication introduces another consideration when a user's credentials must pass from a client through A to B. This additional hop can require correctly configured Kerberos delegation and service principal names. Do not assume that a successful Windows login to A proves delegation to B will work. The detailed mapping rules are documented in sys.sp_addlinkedsrvlogin.
Before the configuration lesson, assemble a short connection plan with the administrator: the instance on which the link will live, the chosen linked-server name, the remote destination, the required database objects, and the identity that should access them. Record who owns each setting. This avoids confusing a reporting user's responsibilities with administrative changes to networking, certificates, and authentication.
The plan should also identify the intended access pattern. Reading selected order columns for a report is a different requirement from executing a procedure that changes order status. State the required operation first, then grant the corresponding access. Keep environment-specific values separate from the reusable lesson example, and arrange for configuration changes to be reviewed and recorded. Subsequent testing can then compare observed behavior with a concrete requirement rather than treating any successful connection as sufficient.
SQL Server 2025 uses Microsoft OLE DB Driver 19 by default for the MSOLEDBSQL linked-server provider. Configure encryption explicitly. The default is Encrypt=Mandatory, so an older linked-server configuration can fail after an upgrade if its certificate arrangement does not meet the connection requirements.
For a production connection, provide a valid server certificate that A trusts and whose identity matches the destination used to connect to B. Encryption protects traffic; certificate validation establishes trust in the server presenting that certificate. A connection problem involving an untrusted certificate is therefore different from an incorrect database password.
The diagram expresses the intended configuration as Encrypt=Mandatory plus a valid trusted certificate. Disabling encryption or bypassing certificate validation should not be the routine response to an upgrade failure. Have the administrator check the provider settings, certificate chain, and destination identity. Microsoft's sys.sp_addlinkedserver documentation describes the SQL Server 2025 provider change and encryption options.
Once a linked server has been configured, this read-only catalog query on A shows its basic settings:
SELECT name, provider, data_source,
is_data_access_enabled, is_rpc_out_enabled
FROM sys.servers
WHERE is_linked = 1
AND name = N'RemoteB';
The data_source value identifies the configured destination, while the two flags distinguish distributed query access from outgoing remote procedure calls. Catalog visibility depends on permissions and configuration. If the expected entry is absent, first confirm that you are connected to A, then ask the administrator to verify the definition and your visibility. Do not immediately create a second link with similar spelling. See sys.servers for the column definitions.
To test connectivity under the current login mapping, run:
EXEC sys.sp_testlinkedserver
@servername = N'RemoteB';
This procedure does not return a table of business data. An unsuccessful test raises an exception describing the failure. A successful test establishes connectivity for that test context, but it does not prove permission to select every table. Follow it with the intended small query against the required object. See sp_testlinkedserver for its behavior.
Record the complete error message and the identity under which the request ran. Changing several unrelated settings at once makes it difficult to determine which condition caused the failure. Use the point at which processing stops to choose the next check:
RemoteB. An SSMS registration is not the missing server-side definition.These are investigation paths, not guarantees that a particular symptom has only one cause. Retest with the intended application or reporting identity after an administrator corrects the problem. A successful administrative test can otherwise hide the permission difference that affects the actual user.
A distributed query may perform work on both instances. SQL Server can send supported operations to the remote provider, but the amount of remote processing depends on the query and provider capabilities. Do not assume that every filter runs on B, or that every remote table is always copied in full to A. Inspect the execution plan and measure the workload. Microsoft explains this behavior in its distributed query architecture guidance.
For the sales-report example, begin with the required columns and a useful restriction on orders. Then consider the remote table's indexes, the number of returned rows, and the frequency of report execution. A small interactive lookup and a repeated scan of a large order history place very different demands on the network and remote system.
OPENQUERY, covered later in the module, supplies a pass-through statement for the linked server to execute. This version keeps the customer restriction inside that statement:
SELECT OrderID, CustomerID
FROM OPENQUERY(RemoteB,
'SELECT OrderID, CustomerID
FROM SalesDB.dbo.Orders
WHERE CustomerID = 42');
It still uses the configured link and its security settings. It is an alternative way to express the request, not an automatic performance improvement or a permission bypass. Its arguments do not directly accept variables. Learn its constraints before adapting it to parameterized application queries; see OPENQUERY.
This module also covers executing procedures on another instance. A distributed SELECT and a remote procedure call are separate operations. The linked-server data access option controls distributed query access, whereas rpc out enables outgoing remote procedure calls. Do not enable additional capabilities solely to make the SELECT example work. Remote procedures also require appropriate execution permissions. The available options are documented in sys.sp_serveroption.
Decide whether direct database access fits the application boundary. A controlled reporting integration may reasonably use a linked server. An application owned by another team may instead expose an API or publish data through an agreed integration process. Those choices determine who controls the interface and how changes are communicated.
For example, a report that reads B's internal tables depends on their names, column meanings, and availability. Renaming a column or taking B offline can affect the report on A. An interface agreed with the owning team makes that dependency explicit. For repeated historical reporting, a separate reporting dataset may be preferable if its refresh delay meets the business requirement.
Before choosing an approach, establish the acceptable data age, expected volume, access permissions, and responsibility for failures. A live remote query can be appropriate when those requirements support it. The existence of a linked-server feature does not itself answer the architectural question.
Include failure behavior in that decision. If the remote system is unavailable, decide whether the report should fail visibly, wait within an agreed limit, or use a separately maintained dataset. Make any freshness limitation clear to the report's readers.
You should now be able to identify where the link is defined, explain the four parts of a remote table name, and trace both the request and returning rows. Keep the client connection, server-to-server connection, and remote permissions separate when planning or diagnosing access.
The next lesson explains how SQL Server accesses remote data sources, building on the Instance A to Instance B model introduced here.