Query different database SQL server

Follow these steps to create a Linked Server:
August 3, 2020 – 10:51 am
How can I clone an SQL Server database on the same server in SQL

Typically linked servers are configured to enable the Database Engine to execute a Transact-SQL statement that includes tables in another instance of SQL Server, or another database product such as Oracle. Many types OLE DB data sources can be configured as linked servers, including Microsoft Access and Excel.

Linked servers offer the following advantages:

  • The ability to access data from outside of SQL Server.
  • The ability to issue distributed queries, updates, commands, and transactions on heterogeneous data sources across the enterprise.
  • The ability to address diverse data sources similarly.

Read more about Linked Servers.

  1. Server Objects -> Linked Servers -> New Linked Server
  2. Provide Remote Server Name.
  3. Select Remote Server Type (SQL Server or Other).
  4. Select Security -> Be made using this security context and provide login and password of remote server.
  5. Click OK and you are done !!

Here is a simple tutorial for creating a linked server.


You can add linked server using query.


sp_addlinkedserver [ @server= ] 'server' [, [ @srvproduct= ] 'product_name' ] [, [ @provider= ] 'provider_name' ] [, [ @datasrc= ] 'data_source' ] [, [ @location= ] 'location' ] [, [ @provstr= ] 'provider_string' ] [, [ @catalog= ] 'catalog' ]

Read more about sp_addlinkedserver.

Source: stackoverflow.com
Related Posts