Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assistance with Union Query Between SQL and Oracle

Status
Not open for further replies.

DeeRuff1

Programmer
May 17, 2005
17
US
Hi There,
I have a problem. I am working in VB.NET and I am doing a call where I have to create a union query that will combine results from a SQL Server database and an Oracle database. These results are populated into a grid. The problem is I am not sure how to create two different connections and then use them to execute the union query and then fill the same grid. Here is an example of the query - the top half comes from a SQL Server database and the bottom half comes from the ORACLE database.

select
s.name, g.interfacecode
from
DSDB2.dbo.GenericHistory g,
DSDB2.dbo.sites s,
DSDB2.dbo.domains d
where
s.site_id = g.site_id
and d.domain_id = g.domain_id
and g.interfacecode = '11'

union

select
DCM.SITE_NAME as name,
DCM.INTERFACE_CODE as interfacecode
from
DC_MASTER DCM,
DC_T1 DCT
where
DCM.PARENT = DCT.GROUP_ID
and DCM.INTERFACE_CODE = '11'


 
Look up Linked Servers. Then you can do all this in SQL Server.

Or

You can get both result sets into separate Datasets and Merge them.
 
Hi,
I tried the linked servers and it was too slow but do you know how I can merge the datasets??? This sounds like a great idea... Thanks for the assist.
 
Just look Up DataSet.Merge. Make sure the column names are the same. Be careful of the second parameter.

Should work fine
 
Thanks.... I will follow up....you're GOOD.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top