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
 Transact-SQL (2000)
 Union two tables from different databases?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-03-01 : 07:47:07
julius writes "What is the sql statement to UNION two tables from different DATABASES?"

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-01 : 07:52:45
select *
from
(
select col1, ....
from dbName1.ownerName1.table1
union all
select col1, ....
from dbName2.ownerName2.table2
) t

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -