Back to results for “Linked Servers”
SQL Server › Linked Servers

What is a linked server in SQL Server, and why would you set one up?

Beginner

Answer

A linked server lets your SQL Server instance connect to and query data from another database server, whether it is another SQL Server instance or a different type of database entirely, allowing you to write queries that combine data from multiple separate database servers as if they were part of the same system.
EXEC sp_addlinkedserver
  @server = 'RemoteServer',
  @srvproduct = '',
  @provider = 'SQLNCLI',
  @datasrc = 'RemoteServerAddress';
Real-world example A company with separate databases for sales and inventory sets up a linked server so their reporting team can write a single query combining data from both systems without manually exporting and merging data by hand.

Common follow-ups: What types of databases can a linked server connect to besides SQL Server?;Does setting up a linked server require special permissions?