Ask Your Question
4

What is the technique for linking multiple JOINs to access a remote table in a query?

asked 2022-06-17 11:00:00 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-07-03 18:00:00 +0000

devzero gravatar image

The technique for linking multiple JOINs to access a remote table in a query is to use the syntax "REMOTESERVERNAME.DBNAME.SCHEMANAME.TABLENAME" for the remote table name in the JOIN statements. The remote server name is the name of the server where the remote table is located, and the DBNAME and SCHEMA_NAME can be omitted if the remote table is located in the default database and schema.

For example, if the remote table is named "customers" located on a server named "remoteserver1", and you want to join it with the local table "orders", the syntax would be:

SELECT * FROM localdb.orders INNER JOIN remoteserver1.remotedb.customerdb.customers ON orders.customerid = customers.customerid

In this example, the "customer_db" is the name of the database where the "customers" table is located on the remote server.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-06-17 11:00:00 +0000

Seen: 13 times

Last updated: Jul 03 '21