Compare two tables, one of sql server vs. another one of pl / sql

0

How or where can I do a select comparing two tables from different databases?

Example:

  • I have two databases, one in SQL Server 2008 r2 and one in Oracle
  • There is a table of ventas_cabecera in both

Which of the platforms gives me an option to consult data from an external DB?

    
asked by Dario Ramirez 08.03.2016 в 14:36
source

2 answers

0

You could create a linked server from Sql Server to reference the db of Oracle

Connecting SQL Server and Oracle Using Linked Servers

Creating a Linked Server for Oracle in 64bit SQL Server

You can link it using the visual tools or using sp_addlinkedserver

Once the server is linked, you can use it in the queries that you make by joining in a JOIN the tables of two different databases.

To refer to the likeada table, you should only respect the nomenclature nombre_linked_server.nombre_catalog.nombre_schema.nombre_tabla

    
answered by 08.03.2016 / 15:03
source
1

In SQL Server you have a functionality called " Linked servers "that allows access to databases of other engines such as Oracle or MySQL (I use it with the latter to obtain data from MantisBT )

In this link to the TechNet have information on how create a linked server

Once you have created and configured the linked server, you can launch queries using openquery considering the query that you throw to the linked server as if it were a table more and making queries similar to the following:

select qMP.name as Project, SUM(qW.WorkTime)
from openquery(PBUGS, 'select id, name from mantis_project_table') as qMP
left outer join work_reporting as qW ON qW.MantProject = qMP.name
group by qMP.name
    
answered by 08.03.2016 в 15:21