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)
 Joining 2 tables from 2 databases

Author  Topic 

gilgamesh
Starting Member

14 Posts

Posted - 2002-05-08 : 04:59:19
I am trying to produce a complete alphabetical listing of 2 tables from 2 separate databases - could anyone tell me how to do it.

PS Once I have retrieved the data is it best to store it in a array to manipulate?

olily
Starting Member

37 Posts

Posted - 2002-05-08 : 05:06:32
SELECT DATABASE1..TABLE1.FIELD1 FROM DATABASE1..TABLE1, DATABASE2..TABLE2


Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2002-05-08 : 05:07:17
You could create a view like this:

SELECT * FROM [database1]..[table1]
UNION
SELECT * FROM [database2]..[table2]

You won't be able to manipulate this, so you may have to create a temp table to do the job. If you wish you can then write a procedure to update the constituent tables.

Tim


Go to Top of Page

rksingh024
Yak Posting Veteran

56 Posts

Posted - 2002-05-08 : 05:14:32
SELECT column_1 FROM database_1..table_1
UNION ALL
SELECT column_2 FROM database_2..table_2
ORDER BY column_1

Assumption is that column_1 and column_2 have same datatype

I usually prefers array to manipulate data on my front end application.

Ramesh



Go to Top of Page
   

- Advertisement -