What is a linked server in SQL Server?
Quick Answer
A linked server is a registered connection to another data source (another SQL Server, or via OLE DB — Oracle, an Excel file) so you can query it with a four-part name (Server.Database.Schema.Table) as if it were local. Convenient for occasional cross-server joins; not a substitute for real data integration at scale.
A linked server lets one SQL Server instance query another data source directly, addressed with a four-part name, so you can join a local table to a remote one almost like it's local. The performance trap is that a plain four-part-name join can end up pulling the whole remote table across the network before filtering; wrapping the remote piece in OPENQUERY pushes the filter to run on the remote server instead. It's also a known security soft spot if the linked login has more privilege than it needs. I use it for occasional cross-server reporting, not as the backbone of an integration — for anything continuous I'd use CDC or a proper ETL pipeline.
OPENQUERY(LinkedServer, 'SELECT ...')pushes the whole query to run remotely — usually much faster than a naive four-part-name join, which can pull the entire remote table back to filter locally.- Distributed transactions across a linked server need MSDTC, which adds fragility.
- Security: linked servers are a common privilege-escalation vector if configured with a sysadmin login — use least-privilege mapped logins.
- For steady, high-volume integration, prefer ETL/CDC/a message queue over a permanent linked server dependency.