Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Create a recordset based on 2 different tables stored in 2 different database on same server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-03-21 : 08:28:35
Shaila writes "My problem is How to Create a recordset based on 2 different tables stored in 2 different database and both the database are on same server..

Example say on one Sql Box, you have 2 different database say DB1 and DB2. In DB1 you have a table called TBL1 and in DB2 you have a table called TBL2. Both the tables are alike.

I want to write a query say

Select Fld1,Fld2,Fld3 From DB1.TBL1
UNION
Select Fld1,Fld2,Fld3 From DB2.TBL2

But this runs into an error. I wonder is there any other way of doing this type of query I mean is it possible to combine data from 2 recordsets other than taking the idea of temp tables.

Please let me know ASAP. It is really urgent

Thank you very much for your precious time

Shaila"
   

- Advertisement -