Aug 8, 2002 #1 tamnguyen MIS Nov 23, 2005 2 CA How to select a union query between 2 tables from 2 separate databases. Thank you.
Aug 8, 2002 #2 Earth Technical User May 8, 2000 59 AU Do the two databases reside on the same server? Upvote 0 Downvote
Aug 8, 2002 #3 mothball MIS Jul 24, 2002 6 US The 2 servers need to be linked or registered. Then all you need to do is fully qualify the tables in the select statement Select * from [ServerA].[DatabaseA].[dbo].[TableA] A join [ServerB].[DatabaseB].[dbo].[TableB] B on A.PrimaryKetID = B.ForeignKeyID Upvote 0 Downvote
The 2 servers need to be linked or registered. Then all you need to do is fully qualify the tables in the select statement Select * from [ServerA].[DatabaseA].[dbo].[TableA] A join [ServerB].[DatabaseB].[dbo].[TableB] B on A.PrimaryKetID = B.ForeignKeyID