加入 Oracle 和 MS SQL Server 的 SQL 语句

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3992573/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 21:45:16  来源:igfitidea点击:

SQL statement joining Oracle and MS SQL Server

sqlsql-serveroraclejoinremote-server

提问by bmw0128

I never seen this, but is it possible to have one SQL call join data from Oracle and SQl Server?

我从未见过这种情况,但是否有可能从 Oracle 和 SQL Server 获得一个 SQL 调用连接数据?

采纳答案by Andomar

Yes- both Oracle and SQL Server support the linked server concept. That allows you to reference the other server using a 4 part name. For example:

是的 - Oracle 和 SQL Server 都支持链接服务器概念。这允许您使用 4 部分名称引用其他服务器。例如:

select  *
from    LocalDb.Schema.Table
cross join
        OracleLinkedServer.RemoteDb.RemoteSchema.RemoteTable

回答by OMG Ponies

Yes, Oracle and SQL Server both have functionality that allows to connect to other databases, including different vendors. In Oracle terminology, it's a database linkinstance while on SQL Server it's called a Linked Serverinstance.

是的,Oracle 和 SQL Server 都具有允许连接到其他数据库(包括不同供应商)的功能。在 Oracle 术语中,它是一个数据库链接实例,而在 SQL Server 上它被称为链接服务器实例。

The syntax to reference the instance is different between Oracle and SQL Server though. IE:

但是,Oracle 和 SQL Server 之间引用实例的语法是不同的。IE:

Oracle:

甲骨文:

SELECT t.*
  FROM table_name@database_link_instance t

SQL Server:

SQL 服务器:

SELECT t.*
  FROM linked_server_instance_name.database_name.schema_name.table_name t

does MySQL support the linked server concept?

MySQL 是否支持链接服务器概念?

No, the closest MySQL has is the FEDERATED engine, which is only for connecting to remote MySQL instances.

不,最近的 MySQL 是 FEDERATED 引擎,它仅用于连接到远程 MySQL 实例。

PostgreSQL?

PostgreSQL?

PostgreSQL has dblink. Last time I looked at dblink (pre-v9 release), it only could connect to other PostgreSQL instances.

PostgreSQL 有dblink。上次我查看 dblink(v9 之前的版本)时,它只能连接到其他 PostgreSQL 实例。