I need a query that retrieves info from an Oracle table and
a query that retrieves info from a SQL Server table. The
info has to be joined together according to Record ID
numbers. I have very limited access to the Oracle database
but full control of the SQL Server database.How do I join
two different queries from two different databases?



I need a query that retrieves info from an Oracle table and a query that retrieves info from a SQL..

Answer / guest

To query to different data sources, you can make the Oracle
server a linked server to the SQL Server server. A linked
server can be any OLE DB data source and SQL Server
currently supports the OLE DB data provider for Oracle. You
can add a linked server by calling sp_AddLinkedServer and
query information about linked servers with sp_LinkedServers.

An easier way to add a linked server is to use Enterprise
Manager. Add the server through the Linked Servers icon in
the Security node. Once a server is linked, you can query it
using a distributed query (you have to specify the full name).

Here's an example of a distributed query (from the SQL
Server Books Online) that queries the Employees table in SQL
Server and the Orders table from Oracle:

SELECT emp.EmloyeeID, ord.OrderID, ord.Discount
FROM SQLServer1.Northwind.dbo.Employees AS emp,
OracleSvr.Catalog1.SchemaX.Orders AS ord
WHERE ord.EmployeeID = emp.EmployeeID
AND ord.Discount > 0

Is This Answer Correct ?    5 Yes 1 No

Post New Answer

More SQL Server Interview Questions

How to insert a new row into a table with "insert into" statements in ms sql server?

0 Answers  


What is the difference between seek predicate and predicate?

0 Answers  


What is an execution plan? How would you view the execution plan?

0 Answers  


Mention the differences between local and global temporary tables.

0 Answers  


In which files does sql server actually store data?

0 Answers  






What is the definition for sql server 2000?

0 Answers  


What are SSL and TSL protocols?

0 Answers   Wipro,


What happens if we shrink log file in sql server?

0 Answers  


List all the types of user-defined functions?

0 Answers  


List the different types of joins?

0 Answers  


What are different types of database indexes?

0 Answers  


PC(code, model, speed, ram, hd, cd, price) Find the hard drive sizes that are equal among two or more PCs.

6 Answers   APX,


Categories