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

i want to join two queries....and i want to run them as one after another that is want output of first query then second , then again output of first query then second and so on...

2 Answers  


Explain sql server service broker?

0 Answers  


What is the guest user account in sql server? What login is it mapped to it? : sql server security

0 Answers  


Define clusters?

0 Answers  


What is user-defined function? Explain its types i.e. Scalar and inline table value user-defined function?

0 Answers  


Explain mixed authentication mode of sql server?

0 Answers  


Where is localdb stored?

0 Answers  


explain different types of constraints? : Sql server database administration

0 Answers  


How to create new tables with "create table" statements in ms sql server?

0 Answers  


What are the differences in Clustering in SQL Server 2005 and 2008 or 2008 R2?

0 Answers  


Explain how does the report manager work in ssrs?

0 Answers  


Hi, I have a table A which has four rows as follows Table A ------- empname salary ------- ------ A 1000 B 2000 C 3000 A 1000 B 2000 D 5000 I need the following output: empname salary ------- ------ A 1000 A 1000 B 2000 B 2000 Thanks in advance

10 Answers   IBM,


Categories