SQL

OPENQUERY Vs LinkedServer

Posted on Updated on

What’s the differences between OPENQUERY vs. Linked Server?

  1. OPENQUERY uses the source server’s processing power to query the data
  2. OPENQUERY returns the result set specific to the WHERE clause making it faster
  3. LinkedServer uses the local server processing power to query all of the source’s data and then reprocesses the data to return the result set
  4. LinkedServer is not a direct call to the source server

How to use OPENQUERY and LinkedServer

ORACLE represents the Providers name under the Linked Servers, Server Objects in SQL MSSMS. (MSSMS -> Object Explorer -> Database -> Server Objects -> Linked Servers – > Providers)

OPENQUERY

SELECT * FROM OPENQUERY(ORACLE,’SELECT * FROM PAYMASTR WHERE CHECK_ID = 1′)

LinkedServer

SELECT * FROM ORACLE.DATABASENAME.dbo.PAYMASTR WHERE CHECK_ID = 1

Advertisements